diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 320746a090bce..fd556f7dd43b8 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -336,6 +336,7 @@ com.azure.resourcemanager:azure-resourcemanager-mobilenetwork;1.0.0-beta.2;1.0.0 com.azure.resourcemanager:azure-resourcemanager-azureadexternalidentities;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-dashboard;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-servicelinker;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-scvmm;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.0.0 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index f24a3d5566bd4..18ec41b32325b 100644 --- a/pom.xml +++ b/pom.xml @@ -955,6 +955,7 @@ sdk/resourcemanager sdk/resourcemover sdk/schemaregistry + sdk/scvmm sdk/search sdk/security sdk/securityinsights diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/CHANGELOG.md b/sdk/scvmm/azure-resourcemanager-scvmm/CHANGELOG.md new file mode 100644 index 0000000000000..337a84f1eb9ac --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-04-20) + +- Azure Resource Manager Scvmm client library for Java. This package contains Microsoft Azure SDK for Scvmm Management SDK. SCVMM Client. Package tag package-2020-06-05-preview. 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/scvmm/azure-resourcemanager-scvmm/README.md b/sdk/scvmm/azure-resourcemanager-scvmm/README.md new file mode 100644 index 0000000000000..6c9082af7db66 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Scvmm client library for Java + +Azure Resource Manager Scvmm client library for Java. + +This package contains Microsoft Azure SDK for Scvmm Management SDK. SCVMM Client. Package tag package-2020-06-05-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-scvmm;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-scvmm + 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(); +ScvmmManager manager = ScvmmManager + .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/scvmm/azure-resourcemanager-scvmm/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/scvmm/azure-resourcemanager-scvmm/SAMPLE.md b/sdk/scvmm/azure-resourcemanager-scvmm/SAMPLE.md new file mode 100644 index 0000000000000..9c305aee14f41 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/SAMPLE.md @@ -0,0 +1,1304 @@ +# Code snippets and samples + + +## AvailabilitySets + +- [CreateOrUpdate](#availabilitysets_createorupdate) +- [Delete](#availabilitysets_delete) +- [GetByResourceGroup](#availabilitysets_getbyresourcegroup) +- [List](#availabilitysets_list) +- [ListByResourceGroup](#availabilitysets_listbyresourcegroup) +- [Update](#availabilitysets_update) + +## Clouds + +- [CreateOrUpdate](#clouds_createorupdate) +- [Delete](#clouds_delete) +- [GetByResourceGroup](#clouds_getbyresourcegroup) +- [List](#clouds_list) +- [ListByResourceGroup](#clouds_listbyresourcegroup) +- [Update](#clouds_update) + +## InventoryItems + +- [Create](#inventoryitems_create) +- [Delete](#inventoryitems_delete) +- [Get](#inventoryitems_get) +- [ListByVmmServer](#inventoryitems_listbyvmmserver) + +## Operations + +- [List](#operations_list) + +## VirtualMachineTemplates + +- [CreateOrUpdate](#virtualmachinetemplates_createorupdate) +- [Delete](#virtualmachinetemplates_delete) +- [GetByResourceGroup](#virtualmachinetemplates_getbyresourcegroup) +- [List](#virtualmachinetemplates_list) +- [ListByResourceGroup](#virtualmachinetemplates_listbyresourcegroup) +- [Update](#virtualmachinetemplates_update) + +## VirtualMachines + +- [CreateCheckpoint](#virtualmachines_createcheckpoint) +- [CreateOrUpdate](#virtualmachines_createorupdate) +- [Delete](#virtualmachines_delete) +- [DeleteCheckpoint](#virtualmachines_deletecheckpoint) +- [GetByResourceGroup](#virtualmachines_getbyresourcegroup) +- [List](#virtualmachines_list) +- [ListByResourceGroup](#virtualmachines_listbyresourcegroup) +- [Restart](#virtualmachines_restart) +- [RestoreCheckpoint](#virtualmachines_restorecheckpoint) +- [Start](#virtualmachines_start) +- [Stop](#virtualmachines_stop) +- [Update](#virtualmachines_update) + +## VirtualNetworks + +- [CreateOrUpdate](#virtualnetworks_createorupdate) +- [Delete](#virtualnetworks_delete) +- [GetByResourceGroup](#virtualnetworks_getbyresourcegroup) +- [List](#virtualnetworks_list) +- [ListByResourceGroup](#virtualnetworks_listbyresourcegroup) +- [Update](#virtualnetworks_update) + +## VmmServers + +- [CreateOrUpdate](#vmmservers_createorupdate) +- [Delete](#vmmservers_delete) +- [GetByResourceGroup](#vmmservers_getbyresourcegroup) +- [List](#vmmservers_list) +- [ListByResourceGroup](#vmmservers_listbyresourcegroup) +- [Update](#vmmservers_update) +### AvailabilitySets_CreateOrUpdate + +```java +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; + +/** Samples for AvailabilitySets CreateOrUpdate. */ +public final class AvailabilitySetsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateAvailabilitySet.json + */ + /** + * Sample code: CreateAvailabilitySet. + * + * @param manager Entry point to ScvmmManager. + */ + public static void createAvailabilitySet(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .availabilitySets() + .define("HRAvailabilitySet") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.Arc/customLocations/contoso")) + .withAvailabilitySetName("hr-avset") + .withVmmServerId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ScVmm/VMMServers/ContosoVMMServer") + .create(); + } +} +``` + +### AvailabilitySets_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for AvailabilitySets Delete. */ +public final class AvailabilitySetsDeleteSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteAvailabilitySet.json + */ + /** + * Sample code: DeleteAvailabilitySet. + * + * @param manager Entry point to ScvmmManager. + */ + public static void deleteAvailabilitySet(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.availabilitySets().delete("testrg", "HRAvailabilitySet", null, Context.NONE); + } +} +``` + +### AvailabilitySets_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for AvailabilitySets GetByResourceGroup. */ +public final class AvailabilitySetsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetAvailabilitySet.json + */ + /** + * Sample code: GetAvailabilitySet. + * + * @param manager Entry point to ScvmmManager. + */ + public static void getAvailabilitySet(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.availabilitySets().getByResourceGroupWithResponse("testrg", "HRAvailabilitySet", Context.NONE); + } +} +``` + +### AvailabilitySets_List + +```java +import com.azure.core.util.Context; + +/** Samples for AvailabilitySets List. */ +public final class AvailabilitySetsListSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListAvailabilitySetsBySubscription.json + */ + /** + * Sample code: ListAvailabilitySetsBySubscription. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listAvailabilitySetsBySubscription(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.availabilitySets().list(Context.NONE); + } +} +``` + +### AvailabilitySets_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for AvailabilitySets ListByResourceGroup. */ +public final class AvailabilitySetsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListAvailabilitySetsByResourceGroup.json + */ + /** + * Sample code: ListAvailabilitySetsByResourceGroup. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listAvailabilitySetsByResourceGroup(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.availabilitySets().listByResourceGroup("testrg", Context.NONE); + } +} +``` + +### AvailabilitySets_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.models.AvailabilitySet; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AvailabilitySets Update. */ +public final class AvailabilitySetsUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateAvailabilitySet.json + */ + /** + * Sample code: UpdateAvailabilitySet. + * + * @param manager Entry point to ScvmmManager. + */ + public static void updateAvailabilitySet(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + AvailabilitySet resource = + manager + .availabilitySets() + .getByResourceGroupWithResponse("testrg", "HRAvailabilitySet", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tag1", "value1", "tag2", "value2")).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; + } +} +``` + +### Clouds_CreateOrUpdate + +```java +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; + +/** Samples for Clouds CreateOrUpdate. */ +public final class CloudsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateCloud.json + */ + /** + * Sample code: CreateCloud. + * + * @param manager Entry point to ScvmmManager. + */ + public static void createCloud(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .clouds() + .define("HRCloud") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.Arc/customLocations/contoso")) + .withUuid("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .withVmmServerId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.SCVMM/VMMServers/ContosoVMMServer") + .create(); + } +} +``` + +### Clouds_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Clouds Delete. */ +public final class CloudsDeleteSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteCloud.json + */ + /** + * Sample code: DeleteCloud. + * + * @param manager Entry point to ScvmmManager. + */ + public static void deleteCloud(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.clouds().delete("testrg", "HRCloud", null, Context.NONE); + } +} +``` + +### Clouds_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Clouds GetByResourceGroup. */ +public final class CloudsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetCloud.json + */ + /** + * Sample code: GetCloud. + * + * @param manager Entry point to ScvmmManager. + */ + public static void getCloud(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.clouds().getByResourceGroupWithResponse("testrg", "HRCloud", Context.NONE); + } +} +``` + +### Clouds_List + +```java +import com.azure.core.util.Context; + +/** Samples for Clouds List. */ +public final class CloudsListSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListCloudsBySubscription.json + */ + /** + * Sample code: ListCloudsBySubscription. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listCloudsBySubscription(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.clouds().list(Context.NONE); + } +} +``` + +### Clouds_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Clouds ListByResourceGroup. */ +public final class CloudsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListCloudsByResourceGroup.json + */ + /** + * Sample code: ListCloudsByResourceGroup. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listCloudsByResourceGroup(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.clouds().listByResourceGroup("testrg", Context.NONE); + } +} +``` + +### Clouds_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.models.Cloud; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Clouds Update. */ +public final class CloudsUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateCloud.json + */ + /** + * Sample code: UpdateCloud. + * + * @param manager Entry point to ScvmmManager. + */ + public static void updateCloud(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + Cloud resource = manager.clouds().getByResourceGroupWithResponse("testrg", "HRCloud", Context.NONE).getValue(); + resource.update().withTags(mapOf("tag1", "value1", "tag2", "value2")).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; + } +} +``` + +### InventoryItems_Create + +```java +/** Samples for InventoryItems Create. */ +public final class InventoryItemsCreateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateInventoryItem.json + */ + /** + * Sample code: CreateInventoryItem. + * + * @param manager Entry point to ScvmmManager. + */ + public static void createInventoryItem(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .inventoryItems() + .define("12345678-1234-1234-1234-123456789abc") + .withExistingVmmServer("testrg", "ContosoVMMServer") + .create(); + } +} +``` + +### InventoryItems_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for InventoryItems Delete. */ +public final class InventoryItemsDeleteSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteInventoryItem.json + */ + /** + * Sample code: DeleteInventoryItem. + * + * @param manager Entry point to ScvmmManager. + */ + public static void deleteInventoryItem(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .inventoryItems() + .deleteWithResponse("testrg", "ContosoVMMServer", "12345678-1234-1234-1234-123456789abc", Context.NONE); + } +} +``` + +### InventoryItems_Get + +```java +import com.azure.core.util.Context; + +/** Samples for InventoryItems Get. */ +public final class InventoryItemsGetSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetInventoryItem.json + */ + /** + * Sample code: GetInventoryItem. + * + * @param manager Entry point to ScvmmManager. + */ + public static void getInventoryItem(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .inventoryItems() + .getWithResponse("testrg", "ContosoVMMServer", "12345678-1234-1234-1234-123456789abc", Context.NONE); + } +} +``` + +### InventoryItems_ListByVmmServer + +```java +import com.azure.core.util.Context; + +/** Samples for InventoryItems ListByVmmServer. */ +public final class InventoryItemsListByVmmServerSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListInventoryItemsByVMMServer.json + */ + /** + * Sample code: InventoryItemsListByVMMServer. + * + * @param manager Entry point to ScvmmManager. + */ + public static void inventoryItemsListByVMMServer(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.inventoryItems().listByVmmServer("testrg", "ContosoVMMServer", Context.NONE); + } +} +``` + +### Operations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListOperations.json + */ + /** + * Sample code: ListOperations. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listOperations(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.operations().list(Context.NONE); + } +} +``` + +### VirtualMachineTemplates_CreateOrUpdate + +```java +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; + +/** Samples for VirtualMachineTemplates CreateOrUpdate. */ +public final class VirtualMachineTemplatesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateVirtualMachineTemplate.json + */ + /** + * Sample code: CreateVirtualMachineTemplate. + * + * @param manager Entry point to ScvmmManager. + */ + public static void createVirtualMachineTemplate(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .virtualMachineTemplates() + .define("HRVirtualMachineTemplate") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.Arc/customLocations/contoso")) + .withUuid("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .withVmmServerId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.SCVMM/VMMServers/ContosoVMMServer") + .create(); + } +} +``` + +### VirtualMachineTemplates_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineTemplates Delete. */ +public final class VirtualMachineTemplatesDeleteSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteVirtualMachineTemplate.json + */ + /** + * Sample code: DeleteVirtualMachineTemplate. + * + * @param manager Entry point to ScvmmManager. + */ + public static void deleteVirtualMachineTemplate(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualMachineTemplates().delete("testrg", "HRVirtualMachineTemplate", null, Context.NONE); + } +} +``` + +### VirtualMachineTemplates_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineTemplates GetByResourceGroup. */ +public final class VirtualMachineTemplatesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetVirtualMachineTemplate.json + */ + /** + * Sample code: GetVirtualMachineTemplate. + * + * @param manager Entry point to ScvmmManager. + */ + public static void getVirtualMachineTemplate(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .virtualMachineTemplates() + .getByResourceGroupWithResponse("testrg", "HRVirtualMachineTemplate", Context.NONE); + } +} +``` + +### VirtualMachineTemplates_List + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineTemplates List. */ +public final class VirtualMachineTemplatesListSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualMachineTemplatesBySubscription.json + */ + /** + * Sample code: ListVirtualMachineTemplatesBySubscription. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listVirtualMachineTemplatesBySubscription(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualMachineTemplates().list(Context.NONE); + } +} +``` + +### VirtualMachineTemplates_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineTemplates ListByResourceGroup. */ +public final class VirtualMachineTemplatesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualMachineTemplatesByResourceGroup.json + */ + /** + * Sample code: ListVirtualMachineTemplatesByResourceGroup. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listVirtualMachineTemplatesByResourceGroup( + com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualMachineTemplates().listByResourceGroup("testrg", Context.NONE); + } +} +``` + +### VirtualMachineTemplates_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.models.VirtualMachineTemplate; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualMachineTemplates Update. */ +public final class VirtualMachineTemplatesUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateVirtualMachineTemplate.json + */ + /** + * Sample code: UpdateVirtualMachineTemplate. + * + * @param manager Entry point to ScvmmManager. + */ + public static void updateVirtualMachineTemplate(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + VirtualMachineTemplate resource = + manager + .virtualMachineTemplates() + .getByResourceGroupWithResponse("testrg", "HRVirtualMachineTemplate", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tag1", "value1", "tag2", "value2")).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; + } +} +``` + +### VirtualMachines_CreateCheckpoint + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.models.VirtualMachineCreateCheckpoint; + +/** Samples for VirtualMachines CreateCheckpoint. */ +public final class VirtualMachinesCreateCheckpointSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateCheckpointVirtualMachine.json + */ + /** + * Sample code: CreateCheckpointVirtualMachine. + * + * @param manager Entry point to ScvmmManager. + */ + public static void createCheckpointVirtualMachine(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .virtualMachines() + .createCheckpoint( + "testrg", + "DemoVM", + new VirtualMachineCreateCheckpoint() + .withName("Demo Checkpoint name") + .withDescription("Demo Checkpoint description"), + Context.NONE); + } +} +``` + +### VirtualMachines_CreateOrUpdate + +```java +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; +import com.azure.resourcemanager.scvmm.models.HardwareProfile; + +/** Samples for VirtualMachines CreateOrUpdate. */ +public final class VirtualMachinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateVirtualMachine.json + */ + /** + * Sample code: CreateVirtualMachine. + * + * @param manager Entry point to ScvmmManager. + */ + public static void createVirtualMachine(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .virtualMachines() + .define("DemoVM") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.Arc/customLocations/contoso")) + .withVmmServerId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.SCVMM/VMMServers/ContosoVMMServer") + .withCloudId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.SCVMM/Clouds/HRCloud") + .withTemplateId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.SCVMM/VirtualMachineTemplates/HRVirtualMachineTemplate") + .withHardwareProfile(new HardwareProfile().withMemoryMB(4096).withCpuCount(4)) + .create(); + } +} +``` + +### VirtualMachines_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Delete. */ +public final class VirtualMachinesDeleteSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteVirtualMachine.json + */ + /** + * Sample code: DeleteVirtualMachine. + * + * @param manager Entry point to ScvmmManager. + */ + public static void deleteVirtualMachine(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualMachines().delete("testrg", "DemoVM", null, null, Context.NONE); + } +} +``` + +### VirtualMachines_DeleteCheckpoint + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.models.VirtualMachineDeleteCheckpoint; + +/** Samples for VirtualMachines DeleteCheckpoint. */ +public final class VirtualMachinesDeleteCheckpointSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteCheckpointVirtualMachine.json + */ + /** + * Sample code: DeleteCheckpointVirtualMachine. + * + * @param manager Entry point to ScvmmManager. + */ + public static void deleteCheckpointVirtualMachine(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .virtualMachines() + .deleteCheckpoint( + "testrg", "DemoVM", new VirtualMachineDeleteCheckpoint().withId("Demo CheckpointID"), Context.NONE); + } +} +``` + +### VirtualMachines_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines GetByResourceGroup. */ +public final class VirtualMachinesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetVirtualMachine.json + */ + /** + * Sample code: GetVirtualMachine. + * + * @param manager Entry point to ScvmmManager. + */ + public static void getVirtualMachine(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualMachines().getByResourceGroupWithResponse("testrg", "DemoVM", Context.NONE); + } +} +``` + +### VirtualMachines_List + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines List. */ +public final class VirtualMachinesListSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualMachinesBySubscription.json + */ + /** + * Sample code: ListVirtualMachinesBySubscription. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listVirtualMachinesBySubscription(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualMachines().list(Context.NONE); + } +} +``` + +### VirtualMachines_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines ListByResourceGroup. */ +public final class VirtualMachinesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualMachinesByResourceGroup.json + */ + /** + * Sample code: ListVirtualMachinesByResourceGroup. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listVirtualMachinesByResourceGroup(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualMachines().listByResourceGroup("testrg", Context.NONE); + } +} +``` + +### VirtualMachines_Restart + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Restart. */ +public final class VirtualMachinesRestartSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/RestartVirtualMachine.json + */ + /** + * Sample code: RestartVirtualMachine. + * + * @param manager Entry point to ScvmmManager. + */ + public static void restartVirtualMachine(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualMachines().restart("testrg", "DemoVM", Context.NONE); + } +} +``` + +### VirtualMachines_RestoreCheckpoint + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.models.VirtualMachineRestoreCheckpoint; + +/** Samples for VirtualMachines RestoreCheckpoint. */ +public final class VirtualMachinesRestoreCheckpointSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/RestoreCheckpointVirtualMachine.json + */ + /** + * Sample code: RestoreCheckpointVirtualMachine. + * + * @param manager Entry point to ScvmmManager. + */ + public static void restoreCheckpointVirtualMachine(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .virtualMachines() + .restoreCheckpoint( + "testrg", "DemoVM", new VirtualMachineRestoreCheckpoint().withId("Demo CheckpointID"), Context.NONE); + } +} +``` + +### VirtualMachines_Start + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Start. */ +public final class VirtualMachinesStartSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/StartVirtualMachine.json + */ + /** + * Sample code: StartVirtualMachine. + * + * @param manager Entry point to ScvmmManager. + */ + public static void startVirtualMachine(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualMachines().start("testrg", "DemoVM", Context.NONE); + } +} +``` + +### VirtualMachines_Stop + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.models.StopVirtualMachineOptions; + +/** Samples for VirtualMachines Stop. */ +public final class VirtualMachinesStopSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/StopVirtualMachine.json + */ + /** + * Sample code: StopVirtualMachine. + * + * @param manager Entry point to ScvmmManager. + */ + public static void stopVirtualMachine(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .virtualMachines() + .stop("testrg", "DemoVM", new StopVirtualMachineOptions().withSkipShutdown(true), Context.NONE); + } +} +``` + +### VirtualMachines_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.models.AllocationMethod; +import com.azure.resourcemanager.scvmm.models.HardwareProfileUpdate; +import com.azure.resourcemanager.scvmm.models.NetworkInterfacesUpdate; +import com.azure.resourcemanager.scvmm.models.NetworkProfileUpdate; +import com.azure.resourcemanager.scvmm.models.StorageProfileUpdate; +import com.azure.resourcemanager.scvmm.models.VirtualDiskUpdate; +import com.azure.resourcemanager.scvmm.models.VirtualMachine; +import com.azure.resourcemanager.scvmm.models.VirtualMachineUpdateProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualMachines Update. */ +public final class VirtualMachinesUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateVirtualMachine.json + */ + /** + * Sample code: UpdateVirtualMachine. + * + * @param manager Entry point to ScvmmManager. + */ + public static void updateVirtualMachine(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + VirtualMachine resource = + manager.virtualMachines().getByResourceGroupWithResponse("testrg", "DemoVM", Context.NONE).getValue(); + resource + .update() + .withTags(mapOf("tag1", "value1", "tag2", "value2")) + .withProperties( + new VirtualMachineUpdateProperties() + .withHardwareProfile(new HardwareProfileUpdate().withMemoryMB(4096).withCpuCount(4)) + .withStorageProfile( + new StorageProfileUpdate() + .withDisks(Arrays.asList(new VirtualDiskUpdate().withName("test").withDiskSizeGB(10)))) + .withNetworkProfile( + new NetworkProfileUpdate() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfacesUpdate() + .withName("test") + .withIpv4AddressType(AllocationMethod.DYNAMIC) + .withIpv6AddressType(AllocationMethod.DYNAMIC) + .withMacAddressType(AllocationMethod.STATIC))))) + .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; + } +} +``` + +### VirtualNetworks_CreateOrUpdate + +```java +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; + +/** Samples for VirtualNetworks CreateOrUpdate. */ +public final class VirtualNetworksCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateVirtualNetwork.json + */ + /** + * Sample code: CreateVirtualNetwork. + * + * @param manager Entry point to ScvmmManager. + */ + public static void createVirtualNetwork(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .virtualNetworks() + .define("HRVirtualNetwork") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.Arc/customLocations/contoso")) + .withUuid("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .withVmmServerId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.SCVMM/VMMServers/ContosoVMMServer") + .create(); + } +} +``` + +### VirtualNetworks_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualNetworks Delete. */ +public final class VirtualNetworksDeleteSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteVirtualNetwork.json + */ + /** + * Sample code: DeleteVirtualNetwork. + * + * @param manager Entry point to ScvmmManager. + */ + public static void deleteVirtualNetwork(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualNetworks().delete("testrg", "HRVirtualNetwork", null, Context.NONE); + } +} +``` + +### VirtualNetworks_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualNetworks GetByResourceGroup. */ +public final class VirtualNetworksGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetVirtualNetwork.json + */ + /** + * Sample code: GetVirtualNetwork. + * + * @param manager Entry point to ScvmmManager. + */ + public static void getVirtualNetwork(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualNetworks().getByResourceGroupWithResponse("testrg", "HRVirtualNetwork", Context.NONE); + } +} +``` + +### VirtualNetworks_List + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualNetworks List. */ +public final class VirtualNetworksListSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualNetworksBySubscription.json + */ + /** + * Sample code: ListVirtualNetworksBySubscription. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listVirtualNetworksBySubscription(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualNetworks().list(Context.NONE); + } +} +``` + +### VirtualNetworks_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualNetworks ListByResourceGroup. */ +public final class VirtualNetworksListByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualNetworksByResourceGroup.json + */ + /** + * Sample code: ListVirtualNetworksByResourceGroup. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listVirtualNetworksByResourceGroup(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualNetworks().listByResourceGroup("testrg", Context.NONE); + } +} +``` + +### VirtualNetworks_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.models.VirtualNetwork; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualNetworks Update. */ +public final class VirtualNetworksUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateVirtualNetwork.json + */ + /** + * Sample code: UpdateVirtualNetwork. + * + * @param manager Entry point to ScvmmManager. + */ + public static void updateVirtualNetwork(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + VirtualNetwork resource = + manager + .virtualNetworks() + .getByResourceGroupWithResponse("testrg", "HRVirtualNetwork", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tag1", "value1", "tag2", "value2")).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; + } +} +``` + +### VmmServers_CreateOrUpdate + +```java +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; +import com.azure.resourcemanager.scvmm.models.VmmServerPropertiesCredentials; + +/** Samples for VmmServers CreateOrUpdate. */ +public final class VmmServersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateVMMServer.json + */ + /** + * Sample code: CreateVMMServer. + * + * @param manager Entry point to ScvmmManager. + */ + public static void createVMMServer(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .vmmServers() + .define("ContosoVMMServer") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.Arc/customLocations/contoso")) + .withFqdn("VMM.contoso.com") + .withCredentials(new VmmServerPropertiesCredentials().withUsername("testuser").withPassword("password")) + .withPort(1234) + .create(); + } +} +``` + +### VmmServers_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for VmmServers Delete. */ +public final class VmmServersDeleteSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteVMMServer.json + */ + /** + * Sample code: DeleteVMMServer. + * + * @param manager Entry point to ScvmmManager. + */ + public static void deleteVMMServer(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.vmmServers().delete("testrg", "ContosoVMMServer", null, Context.NONE); + } +} +``` + +### VmmServers_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for VmmServers GetByResourceGroup. */ +public final class VmmServersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetVMMServer.json + */ + /** + * Sample code: GetVMMServer. + * + * @param manager Entry point to ScvmmManager. + */ + public static void getVMMServer(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.vmmServers().getByResourceGroupWithResponse("testrg", "ContosoVMMServer", Context.NONE); + } +} +``` + +### VmmServers_List + +```java +import com.azure.core.util.Context; + +/** Samples for VmmServers List. */ +public final class VmmServersListSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVMMServersBySubscription.json + */ + /** + * Sample code: ListVmmServersBySubscription. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listVmmServersBySubscription(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.vmmServers().list(Context.NONE); + } +} +``` + +### VmmServers_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for VmmServers ListByResourceGroup. */ +public final class VmmServersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVMMServersByResourceGroup.json + */ + /** + * Sample code: ListVmmServersByResourceGroup. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listVmmServersByResourceGroup(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.vmmServers().listByResourceGroup("testrg", Context.NONE); + } +} +``` + +### VmmServers_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.models.VmmServer; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VmmServers Update. */ +public final class VmmServersUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateVMMServer.json + */ + /** + * Sample code: UpdateVMMServer. + * + * @param manager Entry point to ScvmmManager. + */ + public static void updateVMMServer(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + VmmServer resource = + manager.vmmServers().getByResourceGroupWithResponse("testrg", "ContosoVMMServer", Context.NONE).getValue(); + resource.update().withTags(mapOf("tag1", "value1", "tag2", "value2")).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/scvmm/azure-resourcemanager-scvmm/pom.xml b/sdk/scvmm/azure-resourcemanager-scvmm/pom.xml new file mode 100644 index 0000000000000..1cabb9a0510de --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/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-scvmm + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Scvmm Management + This package contains Microsoft Azure SDK for Scvmm Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. SCVMM Client. Package tag package-2020-06-05-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + + + + com.azure + azure-core + 1.27.0 + + + com.azure + azure-core-management + 1.5.4 + + + diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/ScvmmManager.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/ScvmmManager.java new file mode 100644 index 0000000000000..92feb5324d4c8 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/ScvmmManager.java @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.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.scvmm.fluent.ScvmmClient; +import com.azure.resourcemanager.scvmm.implementation.AvailabilitySetsImpl; +import com.azure.resourcemanager.scvmm.implementation.CloudsImpl; +import com.azure.resourcemanager.scvmm.implementation.InventoryItemsImpl; +import com.azure.resourcemanager.scvmm.implementation.OperationsImpl; +import com.azure.resourcemanager.scvmm.implementation.ScvmmClientBuilder; +import com.azure.resourcemanager.scvmm.implementation.VirtualMachineTemplatesImpl; +import com.azure.resourcemanager.scvmm.implementation.VirtualMachinesImpl; +import com.azure.resourcemanager.scvmm.implementation.VirtualNetworksImpl; +import com.azure.resourcemanager.scvmm.implementation.VmmServersImpl; +import com.azure.resourcemanager.scvmm.models.AvailabilitySets; +import com.azure.resourcemanager.scvmm.models.Clouds; +import com.azure.resourcemanager.scvmm.models.InventoryItems; +import com.azure.resourcemanager.scvmm.models.Operations; +import com.azure.resourcemanager.scvmm.models.VirtualMachineTemplates; +import com.azure.resourcemanager.scvmm.models.VirtualMachines; +import com.azure.resourcemanager.scvmm.models.VirtualNetworks; +import com.azure.resourcemanager.scvmm.models.VmmServers; +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 ScvmmManager. SCVMM Client. */ +public final class ScvmmManager { + private VmmServers vmmServers; + + private Operations operations; + + private Clouds clouds; + + private VirtualNetworks virtualNetworks; + + private VirtualMachines virtualMachines; + + private VirtualMachineTemplates virtualMachineTemplates; + + private AvailabilitySets availabilitySets; + + private InventoryItems inventoryItems; + + private final ScvmmClient clientObject; + + private ScvmmManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new ScvmmClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Scvmm service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Scvmm service API instance. + */ + public static ScvmmManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of Scvmm service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Scvmm service API instance. + */ + public static ScvmmManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ScvmmManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ScvmmManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ScvmmManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private static 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 RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Scvmm service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Scvmm service API instance. + */ + public ScvmmManager 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.scvmm") + .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) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new 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 ScvmmManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of VmmServers. */ + public VmmServers vmmServers() { + if (this.vmmServers == null) { + this.vmmServers = new VmmServersImpl(clientObject.getVmmServers(), this); + } + return vmmServers; + } + + /** @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 Clouds. */ + public Clouds clouds() { + if (this.clouds == null) { + this.clouds = new CloudsImpl(clientObject.getClouds(), this); + } + return clouds; + } + + /** @return Resource collection API of VirtualNetworks. */ + public VirtualNetworks virtualNetworks() { + if (this.virtualNetworks == null) { + this.virtualNetworks = new VirtualNetworksImpl(clientObject.getVirtualNetworks(), this); + } + return virtualNetworks; + } + + /** @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 VirtualMachineTemplates. */ + public VirtualMachineTemplates virtualMachineTemplates() { + if (this.virtualMachineTemplates == null) { + this.virtualMachineTemplates = + new VirtualMachineTemplatesImpl(clientObject.getVirtualMachineTemplates(), this); + } + return virtualMachineTemplates; + } + + /** @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 InventoryItems. */ + public InventoryItems inventoryItems() { + if (this.inventoryItems == null) { + this.inventoryItems = new InventoryItemsImpl(clientObject.getInventoryItems(), this); + } + return inventoryItems; + } + + /** + * @return Wrapped service client ScvmmClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public ScvmmClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/AvailabilitySetsClient.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/AvailabilitySetsClient.java new file mode 100644 index 0000000000000..41a0d72042414 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/AvailabilitySetsClient.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.scvmm.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.scvmm.fluent.models.AvailabilitySetInner; +import com.azure.resourcemanager.scvmm.models.ResourcePatch; + +/** An instance of this class provides access to all the operations defined in AvailabilitySetsClient. */ +public interface AvailabilitySetsClient { + /** + * Implements AvailabilitySet GET method. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AvailabilitySetInner getByResourceGroup(String resourceGroupName, String availabilitySetName); + + /** + * Implements AvailabilitySet GET method. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String availabilitySetName, Context context); + + /** + * Onboards the ScVmm availability set as an Azure resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AvailabilitySetInner> beginCreateOrUpdate( + String resourceGroupName, String availabilitySetName, AvailabilitySetInner body); + + /** + * Onboards the ScVmm availability set as an Azure resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AvailabilitySetInner> beginCreateOrUpdate( + String resourceGroupName, String availabilitySetName, AvailabilitySetInner body, Context context); + + /** + * Onboards the ScVmm availability set as an Azure resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AvailabilitySetInner createOrUpdate( + String resourceGroupName, String availabilitySetName, AvailabilitySetInner body); + + /** + * Onboards the ScVmm availability set as an Azure resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AvailabilitySetInner createOrUpdate( + String resourceGroupName, String availabilitySetName, AvailabilitySetInner body, Context context); + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String availabilitySetName, Boolean force); + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String availabilitySetName, Boolean force, Context context); + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 availabilitySetName, Boolean force); + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 availabilitySetName); + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 availabilitySetName, Boolean force, Context context); + + /** + * Updates the AvailabilitySets resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body AvailabilitySets patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AvailabilitySetInner> beginUpdate( + String resourceGroupName, String availabilitySetName, ResourcePatch body); + + /** + * Updates the AvailabilitySets resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body AvailabilitySets patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AvailabilitySetInner> beginUpdate( + String resourceGroupName, String availabilitySetName, ResourcePatch body, Context context); + + /** + * Updates the AvailabilitySets resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body AvailabilitySets patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AvailabilitySetInner update(String resourceGroupName, String availabilitySetName, ResourcePatch body); + + /** + * Updates the AvailabilitySets resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body AvailabilitySets patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AvailabilitySetInner update( + String resourceGroupName, String availabilitySetName, ResourcePatch body, Context context); + + /** + * List of AvailabilitySets in 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 list of AvailabilitySets as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of AvailabilitySets 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.core.management.exception.ManagementException 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 AvailabilitySets as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List of AvailabilitySets in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of AvailabilitySets as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List of AvailabilitySets in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of AvailabilitySets as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/CloudsClient.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/CloudsClient.java new file mode 100644 index 0000000000000..6f3236475f18a --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/CloudsClient.java @@ -0,0 +1,285 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.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.scvmm.fluent.models.CloudInner; +import com.azure.resourcemanager.scvmm.models.ResourcePatch; + +/** An instance of this class provides access to all the operations defined in CloudsClient. */ +public interface CloudsClient { + /** + * Implements Cloud GET method. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudInner getByResourceGroup(String resourceGroupName, String cloudName); + + /** + * Implements Cloud GET method. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String cloudName, Context context); + + /** + * Onboards the ScVmm fabric cloud as an Azure cloud resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudInner> beginCreateOrUpdate( + String resourceGroupName, String cloudName, CloudInner body); + + /** + * Onboards the ScVmm fabric cloud as an Azure cloud resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudInner> beginCreateOrUpdate( + String resourceGroupName, String cloudName, CloudInner body, Context context); + + /** + * Onboards the ScVmm fabric cloud as an Azure cloud resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudInner createOrUpdate(String resourceGroupName, String cloudName, CloudInner body); + + /** + * Onboards the ScVmm fabric cloud as an Azure cloud resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudInner createOrUpdate(String resourceGroupName, String cloudName, CloudInner body, Context context); + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String cloudName, Boolean force); + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String cloudName, Boolean force, Context context); + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 cloudName, Boolean force); + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 cloudName); + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 cloudName, Boolean force, Context context); + + /** + * Updates the Clouds resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Clouds patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudInner> beginUpdate( + String resourceGroupName, String cloudName, ResourcePatch body); + + /** + * Updates the Clouds resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Clouds patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CloudInner> beginUpdate( + String resourceGroupName, String cloudName, ResourcePatch body, Context context); + + /** + * Updates the Clouds resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Clouds patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudInner update(String resourceGroupName, String cloudName, ResourcePatch body); + + /** + * Updates the Clouds resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Clouds patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CloudInner update(String resourceGroupName, String cloudName, ResourcePatch body, Context context); + + /** + * List of Clouds in 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 list of Clouds as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of Clouds 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.core.management.exception.ManagementException 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 Clouds as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List of Clouds in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Clouds as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List of Clouds in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Clouds as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/InventoryItemsClient.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/InventoryItemsClient.java new file mode 100644 index 0000000000000..cb386bca2ecc2 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/InventoryItemsClient.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.scvmm.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.scvmm.fluent.models.InventoryItemInner; + +/** An instance of this class provides access to all the operations defined in InventoryItemsClient. */ +public interface InventoryItemsClient { + /** + * Create Or Update InventoryItem. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the inventory item. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InventoryItemInner create(String resourceGroupName, String vmmServerName, String inventoryItemName); + + /** + * Create Or Update InventoryItem. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the inventory item along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String vmmServerName, + String inventoryItemName, + InventoryItemInner body, + Context context); + + /** + * Shows an inventory item. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the inventory item. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InventoryItemInner get(String resourceGroupName, String vmmServerName, String inventoryItemName); + + /** + * Shows an inventory item. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the inventory item along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String vmmServerName, String inventoryItemName, Context context); + + /** + * Deletes an inventoryItem. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 vmmServerName, String inventoryItemName); + + /** + * Deletes an inventoryItem. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 vmmServerName, String inventoryItemName, Context context); + + /** + * Returns the list of inventoryItems in the given VMMServer. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 InventoryItems as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByVmmServer(String resourceGroupName, String vmmServerName); + + /** + * Returns the list of inventoryItems in the given VMMServer. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 InventoryItems as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByVmmServer(String resourceGroupName, String vmmServerName, Context context); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/OperationsClient.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/OperationsClient.java new file mode 100644 index 0000000000000..36f33fb8ffe24 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/OperationsClient.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.scvmm.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.scvmm.fluent.models.ResourceProviderOperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Returns list of all operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Returns list of all operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/ScvmmClient.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/ScvmmClient.java new file mode 100644 index 0000000000000..7d130a42a24bc --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/ScvmmClient.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.scvmm.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for ScvmmClient class. */ +public interface ScvmmClient { + /** + * Gets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the VmmServersClient object to access its operations. + * + * @return the VmmServersClient object. + */ + VmmServersClient getVmmServers(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the CloudsClient object to access its operations. + * + * @return the CloudsClient object. + */ + CloudsClient getClouds(); + + /** + * Gets the VirtualNetworksClient object to access its operations. + * + * @return the VirtualNetworksClient object. + */ + VirtualNetworksClient getVirtualNetworks(); + + /** + * Gets the VirtualMachinesClient object to access its operations. + * + * @return the VirtualMachinesClient object. + */ + VirtualMachinesClient getVirtualMachines(); + + /** + * Gets the VirtualMachineTemplatesClient object to access its operations. + * + * @return the VirtualMachineTemplatesClient object. + */ + VirtualMachineTemplatesClient getVirtualMachineTemplates(); + + /** + * Gets the AvailabilitySetsClient object to access its operations. + * + * @return the AvailabilitySetsClient object. + */ + AvailabilitySetsClient getAvailabilitySets(); + + /** + * Gets the InventoryItemsClient object to access its operations. + * + * @return the InventoryItemsClient object. + */ + InventoryItemsClient getInventoryItems(); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/VirtualMachineTemplatesClient.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/VirtualMachineTemplatesClient.java new file mode 100644 index 0000000000000..4cb11297666b4 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/VirtualMachineTemplatesClient.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.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.scvmm.fluent.models.VirtualMachineTemplateInner; +import com.azure.resourcemanager.scvmm.models.ResourcePatch; + +/** An instance of this class provides access to all the operations defined in VirtualMachineTemplatesClient. */ +public interface VirtualMachineTemplatesClient { + /** + * Implements VirtualMachineTemplate GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineTemplateInner getByResourceGroup(String resourceGroupName, String virtualMachineTemplateName); + + /** + * Implements VirtualMachineTemplate GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualMachineTemplateName, Context context); + + /** + * Onboards the ScVmm VM Template as an Azure VM Template resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineTemplateInner> beginCreateOrUpdate( + String resourceGroupName, String virtualMachineTemplateName, VirtualMachineTemplateInner body); + + /** + * Onboards the ScVmm VM Template as an Azure VM Template resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineTemplateInner> beginCreateOrUpdate( + String resourceGroupName, String virtualMachineTemplateName, VirtualMachineTemplateInner body, Context context); + + /** + * Onboards the ScVmm VM Template as an Azure VM Template resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineTemplateInner createOrUpdate( + String resourceGroupName, String virtualMachineTemplateName, VirtualMachineTemplateInner body); + + /** + * Onboards the ScVmm VM Template as an Azure VM Template resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineTemplateInner createOrUpdate( + String resourceGroupName, String virtualMachineTemplateName, VirtualMachineTemplateInner body, Context context); + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String virtualMachineTemplateName, Boolean force); + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String virtualMachineTemplateName, Boolean force, Context context); + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualMachineTemplateName, Boolean force); + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualMachineTemplateName); + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualMachineTemplateName, Boolean force, Context context); + + /** + * Updates the VirtualMachineTemplate resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body VirtualMachineTemplates patch details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineTemplateInner> beginUpdate( + String resourceGroupName, String virtualMachineTemplateName, ResourcePatch body); + + /** + * Updates the VirtualMachineTemplate resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body VirtualMachineTemplates patch details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineTemplateInner> beginUpdate( + String resourceGroupName, String virtualMachineTemplateName, ResourcePatch body, Context context); + + /** + * Updates the VirtualMachineTemplate resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body VirtualMachineTemplates patch details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineTemplateInner update(String resourceGroupName, String virtualMachineTemplateName, ResourcePatch body); + + /** + * Updates the VirtualMachineTemplate resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body VirtualMachineTemplates patch details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineTemplateInner update( + String resourceGroupName, String virtualMachineTemplateName, ResourcePatch body, Context context); + + /** + * List of VirtualMachineTemplates in 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 list of VirtualMachineTemplates as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of VirtualMachineTemplates 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.core.management.exception.ManagementException 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 VirtualMachineTemplates as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List of VirtualMachineTemplates in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualMachineTemplates as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List of VirtualMachineTemplates in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualMachineTemplates as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/VirtualMachinesClient.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/VirtualMachinesClient.java new file mode 100644 index 0000000000000..ea76ff19ba7d8 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/VirtualMachinesClient.java @@ -0,0 +1,685 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.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.scvmm.fluent.models.VirtualMachineInner; +import com.azure.resourcemanager.scvmm.models.StopVirtualMachineOptions; +import com.azure.resourcemanager.scvmm.models.VirtualMachineCreateCheckpoint; +import com.azure.resourcemanager.scvmm.models.VirtualMachineDeleteCheckpoint; +import com.azure.resourcemanager.scvmm.models.VirtualMachineRestoreCheckpoint; +import com.azure.resourcemanager.scvmm.models.VirtualMachineUpdate; + +/** An instance of this class provides access to all the operations defined in VirtualMachinesClient. */ +public interface VirtualMachinesClient { + /** + * Implements VirtualMachine GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInner getByResourceGroup(String resourceGroupName, String virtualMachineName); + + /** + * Implements VirtualMachine GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualMachineName, Context context); + + /** + * Creates Or Updates virtual machines deployed on scvmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineInner> beginCreateOrUpdate( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body); + + /** + * Creates Or Updates virtual machines deployed on scvmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineInner> beginCreateOrUpdate( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body, Context context); + + /** + * Creates Or Updates virtual machines deployed on scvmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInner createOrUpdate(String resourceGroupName, String virtualMachineName, VirtualMachineInner body); + + /** + * Creates Or Updates virtual machines deployed on scvmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInner createOrUpdate( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body, Context context); + + /** + * Deletes a VirtualMachine deployed on ScVmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param retain Whether to just disable the VM from azure and retain the VM in the VMM. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String virtualMachineName, Boolean retain, Boolean force); + + /** + * Deletes a VirtualMachine deployed on ScVmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param retain Whether to just disable the VM from azure and retain the VM in the VMM. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String virtualMachineName, Boolean retain, Boolean force, Context context); + + /** + * Deletes a VirtualMachine deployed on ScVmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param retain Whether to just disable the VM from azure and retain the VM in the VMM. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualMachineName, Boolean retain, Boolean force); + + /** + * Deletes a VirtualMachine deployed on ScVmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualMachineName); + + /** + * Deletes a VirtualMachine deployed on ScVmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param retain Whether to just disable the VM from azure and retain the VM in the VMM. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualMachineName, Boolean retain, Boolean force, Context context); + + /** + * Updates the VirtualMachines resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body VirtualMachines patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineInner> beginUpdate( + String resourceGroupName, String virtualMachineName, VirtualMachineUpdate body); + + /** + * Updates the VirtualMachines resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body VirtualMachines patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineInner> beginUpdate( + String resourceGroupName, String virtualMachineName, VirtualMachineUpdate body, Context context); + + /** + * Updates the VirtualMachines resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body VirtualMachines patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInner update(String resourceGroupName, String virtualMachineName, VirtualMachineUpdate body); + + /** + * Updates the VirtualMachines resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body VirtualMachines patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInner update( + String resourceGroupName, String virtualMachineName, VirtualMachineUpdate body, Context context); + + /** + * Stop virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine stop action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStop( + String resourceGroupName, String virtualMachineName, StopVirtualMachineOptions body); + + /** + * Stop virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine stop action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStop( + String resourceGroupName, String virtualMachineName, StopVirtualMachineOptions body, Context context); + + /** + * Stop virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine stop action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void stop(String resourceGroupName, String virtualMachineName, StopVirtualMachineOptions body); + + /** + * Stop virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void stop(String resourceGroupName, String virtualMachineName); + + /** + * Stop virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine stop action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void stop(String resourceGroupName, String virtualMachineName, StopVirtualMachineOptions body, Context context); + + /** + * Start virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart(String resourceGroupName, String virtualMachineName); + + /** + * Start virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart(String resourceGroupName, String virtualMachineName, Context context); + + /** + * Start virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void start(String resourceGroupName, String virtualMachineName); + + /** + * Start virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void start(String resourceGroupName, String virtualMachineName, Context context); + + /** + * Restart virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart(String resourceGroupName, String virtualMachineName); + + /** + * Restart virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart( + String resourceGroupName, String virtualMachineName, Context context); + + /** + * Restart virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void restart(String resourceGroupName, String virtualMachineName); + + /** + * Restart virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void restart(String resourceGroupName, String virtualMachineName, Context context); + + /** + * Creates a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine create checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginCreateCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineCreateCheckpoint body); + + /** + * Creates a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine create checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginCreateCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineCreateCheckpoint body, Context context); + + /** + * Creates a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine create checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 createCheckpoint(String resourceGroupName, String virtualMachineName, VirtualMachineCreateCheckpoint body); + + /** + * Creates a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 createCheckpoint(String resourceGroupName, String virtualMachineName); + + /** + * Creates a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine create checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 createCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineCreateCheckpoint body, Context context); + + /** + * Deletes a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine delete checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineDeleteCheckpoint body); + + /** + * Deletes a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine delete checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineDeleteCheckpoint body, Context context); + + /** + * Deletes a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine delete checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 deleteCheckpoint(String resourceGroupName, String virtualMachineName, VirtualMachineDeleteCheckpoint body); + + /** + * Deletes a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 deleteCheckpoint(String resourceGroupName, String virtualMachineName); + + /** + * Deletes a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine delete checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 deleteCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineDeleteCheckpoint body, Context context); + + /** + * Restores to a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine restore checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestoreCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineRestoreCheckpoint body); + + /** + * Restores to a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine restore checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestoreCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineRestoreCheckpoint body, Context context); + + /** + * Restores to a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine restore checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 restoreCheckpoint(String resourceGroupName, String virtualMachineName, VirtualMachineRestoreCheckpoint body); + + /** + * Restores to a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 restoreCheckpoint(String resourceGroupName, String virtualMachineName); + + /** + * Restores to a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine restore checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 restoreCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineRestoreCheckpoint body, Context context); + + /** + * List of VirtualMachines in 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 list of VirtualMachines as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of VirtualMachines 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.core.management.exception.ManagementException 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 VirtualMachines as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List of VirtualMachines in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualMachines as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List of VirtualMachines in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualMachines as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/VirtualNetworksClient.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/VirtualNetworksClient.java new file mode 100644 index 0000000000000..ac674ac85490f --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/VirtualNetworksClient.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.scvmm.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.scvmm.fluent.models.VirtualNetworkInner; +import com.azure.resourcemanager.scvmm.models.ResourcePatch; + +/** An instance of this class provides access to all the operations defined in VirtualNetworksClient. */ +public interface VirtualNetworksClient { + /** + * Implements VirtualNetwork GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkInner getByResourceGroup(String resourceGroupName, String virtualNetworkName); + + /** + * Implements VirtualNetwork GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualNetworkName, Context context); + + /** + * Onboards the ScVmm virtual network as an Azure virtual network resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualNetworkInner> beginCreateOrUpdate( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body); + + /** + * Onboards the ScVmm virtual network as an Azure virtual network resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualNetworkInner> beginCreateOrUpdate( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body, Context context); + + /** + * Onboards the ScVmm virtual network as an Azure virtual network resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkInner createOrUpdate(String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body); + + /** + * Onboards the ScVmm virtual network as an Azure virtual network resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkInner createOrUpdate( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body, Context context); + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String virtualNetworkName, Boolean force); + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String virtualNetworkName, Boolean force, Context context); + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualNetworkName, Boolean force); + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualNetworkName); + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualNetworkName, Boolean force, Context context); + + /** + * Updates the VirtualNetworks resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body VirtualNetworks patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualNetworkInner> beginUpdate( + String resourceGroupName, String virtualNetworkName, ResourcePatch body); + + /** + * Updates the VirtualNetworks resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body VirtualNetworks patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualNetworkInner> beginUpdate( + String resourceGroupName, String virtualNetworkName, ResourcePatch body, Context context); + + /** + * Updates the VirtualNetworks resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body VirtualNetworks patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkInner update(String resourceGroupName, String virtualNetworkName, ResourcePatch body); + + /** + * Updates the VirtualNetworks resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body VirtualNetworks patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkInner update( + String resourceGroupName, String virtualNetworkName, ResourcePatch body, Context context); + + /** + * List of VirtualNetworks in 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 list of VirtualNetworks as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of VirtualNetworks 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.core.management.exception.ManagementException 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 VirtualNetworks as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List of VirtualNetworks in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualNetworks as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List of VirtualNetworks in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualNetworks as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/VmmServersClient.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/VmmServersClient.java new file mode 100644 index 0000000000000..fa50ed9e81f21 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/VmmServersClient.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.scvmm.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.scvmm.fluent.models.VmmServerInner; +import com.azure.resourcemanager.scvmm.models.ResourcePatch; + +/** An instance of this class provides access to all the operations defined in VmmServersClient. */ +public interface VmmServersClient { + /** + * Implements VMMServer GET method. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VmmServerInner getByResourceGroup(String resourceGroupName, String vmmServerName); + + /** + * Implements VMMServer GET method. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String vmmServerName, Context context); + + /** + * Onboards the SCVMM fabric as an Azure VmmServer resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VmmServerInner> beginCreateOrUpdate( + String resourceGroupName, String vmmServerName, VmmServerInner body); + + /** + * Onboards the SCVMM fabric as an Azure VmmServer resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VmmServerInner> beginCreateOrUpdate( + String resourceGroupName, String vmmServerName, VmmServerInner body, Context context); + + /** + * Onboards the SCVMM fabric as an Azure VmmServer resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VmmServerInner createOrUpdate(String resourceGroupName, String vmmServerName, VmmServerInner body); + + /** + * Onboards the SCVMM fabric as an Azure VmmServer resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VmmServerInner createOrUpdate(String resourceGroupName, String vmmServerName, VmmServerInner body, Context context); + + /** + * Deboards the SCVMM fabric from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String vmmServerName, Boolean force); + + /** + * Deboards the SCVMM fabric from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String vmmServerName, Boolean force, Context context); + + /** + * Deboards the SCVMM fabric from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 vmmServerName, Boolean force); + + /** + * Deboards the SCVMM fabric from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 vmmServerName); + + /** + * Deboards the SCVMM fabric from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 vmmServerName, Boolean force, Context context); + + /** + * Updates the VmmServers resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body VmmServers patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VmmServerInner> beginUpdate( + String resourceGroupName, String vmmServerName, ResourcePatch body); + + /** + * Updates the VmmServers resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body VmmServers patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VmmServerInner> beginUpdate( + String resourceGroupName, String vmmServerName, ResourcePatch body, Context context); + + /** + * Updates the VmmServers resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body VmmServers patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VmmServerInner update(String resourceGroupName, String vmmServerName, ResourcePatch body); + + /** + * Updates the VmmServers resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body VmmServers patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VmmServerInner update(String resourceGroupName, String vmmServerName, ResourcePatch body, Context context); + + /** + * List of VmmServers in 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 list of VmmServers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of VmmServers 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.core.management.exception.ManagementException 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 VmmServers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List of VmmServers in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VmmServers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List of VmmServers in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VmmServers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/AvailabilitySetInner.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/AvailabilitySetInner.java new file mode 100644 index 0000000000000..ff4f7f540c2ac --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/AvailabilitySetInner.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.scvmm.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The AvailabilitySets resource definition. */ +@Fluent +public final class AvailabilitySetInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private AvailabilitySetProperties innerProperties; + + /* + * The system data. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The extended location. + */ + @JsonProperty(value = "extendedLocation") + private ExtendedLocation extendedLocation; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private AvailabilitySetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: The system data. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the extendedLocation property: The extended location. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extended location. + * + * @param extendedLocation the extendedLocation value to set. + * @return the AvailabilitySetInner object itself. + */ + public AvailabilitySetInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + 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 availabilitySetName property: Name of the availability set. + * + * @return the availabilitySetName value. + */ + public String availabilitySetName() { + return this.innerProperties() == null ? null : this.innerProperties().availabilitySetName(); + } + + /** + * Set the availabilitySetName property: Name of the availability set. + * + * @param availabilitySetName the availabilitySetName value to set. + * @return the AvailabilitySetInner object itself. + */ + public AvailabilitySetInner withAvailabilitySetName(String availabilitySetName) { + if (this.innerProperties() == null) { + this.innerProperties = new AvailabilitySetProperties(); + } + this.innerProperties().withAvailabilitySetName(availabilitySetName); + return this; + } + + /** + * Get the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @return the vmmServerId value. + */ + public String vmmServerId() { + return this.innerProperties() == null ? null : this.innerProperties().vmmServerId(); + } + + /** + * Set the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @param vmmServerId the vmmServerId value to set. + * @return the AvailabilitySetInner object itself. + */ + public AvailabilitySetInner withVmmServerId(String vmmServerId) { + if (this.innerProperties() == null) { + this.innerProperties = new AvailabilitySetProperties(); + } + this.innerProperties().withVmmServerId(vmmServerId); + return this; + } + + /** + * Get the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + public String 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(); + } + if (extendedLocation() != null) { + extendedLocation().validate(); + } + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/AvailabilitySetProperties.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/AvailabilitySetProperties.java new file mode 100644 index 0000000000000..16bb3669ea231 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/AvailabilitySetProperties.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.scvmm.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the resource properties. */ +@Fluent +public final class AvailabilitySetProperties { + /* + * Name of the availability set. + */ + @JsonProperty(value = "availabilitySetName") + private String availabilitySetName; + + /* + * ARM Id of the vmmServer resource in which this resource resides. + */ + @JsonProperty(value = "vmmServerId") + private String vmmServerId; + + /* + * Gets or sets the provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the availabilitySetName property: Name of the availability set. + * + * @return the availabilitySetName value. + */ + public String availabilitySetName() { + return this.availabilitySetName; + } + + /** + * Set the availabilitySetName property: Name of the availability set. + * + * @param availabilitySetName the availabilitySetName value to set. + * @return the AvailabilitySetProperties object itself. + */ + public AvailabilitySetProperties withAvailabilitySetName(String availabilitySetName) { + this.availabilitySetName = availabilitySetName; + return this; + } + + /** + * Get the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @return the vmmServerId value. + */ + public String vmmServerId() { + return this.vmmServerId; + } + + /** + * Set the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @param vmmServerId the vmmServerId value to set. + * @return the AvailabilitySetProperties object itself. + */ + public AvailabilitySetProperties withVmmServerId(String vmmServerId) { + this.vmmServerId = vmmServerId; + return this; + } + + /** + * Get the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/CloudInner.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/CloudInner.java new file mode 100644 index 0000000000000..ee1551b8e7c3c --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/CloudInner.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.scvmm.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.scvmm.models.CloudCapacity; +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; +import com.azure.resourcemanager.scvmm.models.StorageQoSPolicy; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The Clouds resource definition. */ +@Fluent +public final class CloudInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties", required = true) + private CloudProperties innerProperties = new CloudProperties(); + + /* + * The system data. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The extended location. + */ + @JsonProperty(value = "extendedLocation", required = true) + private ExtendedLocation extendedLocation; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private CloudProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: The system data. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the extendedLocation property: The extended location. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extended location. + * + * @param extendedLocation the extendedLocation value to set. + * @return the CloudInner object itself. + */ + public CloudInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** {@inheritDoc} */ + @Override + public CloudInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CloudInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @return the inventoryItemId value. + */ + public String inventoryItemId() { + return this.innerProperties() == null ? null : this.innerProperties().inventoryItemId(); + } + + /** + * Set the inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @param inventoryItemId the inventoryItemId value to set. + * @return the CloudInner object itself. + */ + public CloudInner withInventoryItemId(String inventoryItemId) { + if (this.innerProperties() == null) { + this.innerProperties = new CloudProperties(); + } + this.innerProperties().withInventoryItemId(inventoryItemId); + return this; + } + + /** + * Get the uuid property: Unique ID of the cloud. + * + * @return the uuid value. + */ + public String uuid() { + return this.innerProperties() == null ? null : this.innerProperties().uuid(); + } + + /** + * Set the uuid property: Unique ID of the cloud. + * + * @param uuid the uuid value to set. + * @return the CloudInner object itself. + */ + public CloudInner withUuid(String uuid) { + if (this.innerProperties() == null) { + this.innerProperties = new CloudProperties(); + } + this.innerProperties().withUuid(uuid); + return this; + } + + /** + * Get the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @return the vmmServerId value. + */ + public String vmmServerId() { + return this.innerProperties() == null ? null : this.innerProperties().vmmServerId(); + } + + /** + * Set the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @param vmmServerId the vmmServerId value to set. + * @return the CloudInner object itself. + */ + public CloudInner withVmmServerId(String vmmServerId) { + if (this.innerProperties() == null) { + this.innerProperties = new CloudProperties(); + } + this.innerProperties().withVmmServerId(vmmServerId); + return this; + } + + /** + * Get the cloudName property: Name of the cloud in VMMServer. + * + * @return the cloudName value. + */ + public String cloudName() { + return this.innerProperties() == null ? null : this.innerProperties().cloudName(); + } + + /** + * Get the cloudCapacity property: Capacity of the cloud. + * + * @return the cloudCapacity value. + */ + public CloudCapacity cloudCapacity() { + return this.innerProperties() == null ? null : this.innerProperties().cloudCapacity(); + } + + /** + * Get the storageQoSPolicies property: List of QoS policies available for the cloud. + * + * @return the storageQoSPolicies value. + */ + public List storageQoSPolicies() { + return this.innerProperties() == null ? null : this.innerProperties().storageQoSPolicies(); + } + + /** + * Get the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + public String 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property innerProperties in model CloudInner")); + } else { + innerProperties().validate(); + } + if (extendedLocation() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property extendedLocation in model CloudInner")); + } else { + extendedLocation().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CloudInner.class); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/CloudProperties.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/CloudProperties.java new file mode 100644 index 0000000000000..feed0e6a045ca --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/CloudProperties.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.scvmm.models.CloudCapacity; +import com.azure.resourcemanager.scvmm.models.StorageQoSPolicy; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Defines the resource properties. */ +@Fluent +public final class CloudProperties { + /* + * Gets or sets the inventory Item ID for the resource. + */ + @JsonProperty(value = "inventoryItemId") + private String inventoryItemId; + + /* + * Unique ID of the cloud. + */ + @JsonProperty(value = "uuid") + private String uuid; + + /* + * ARM Id of the vmmServer resource in which this resource resides. + */ + @JsonProperty(value = "vmmServerId") + private String vmmServerId; + + /* + * Name of the cloud in VMMServer. + */ + @JsonProperty(value = "cloudName", access = JsonProperty.Access.WRITE_ONLY) + private String cloudName; + + /* + * Capacity of the cloud. + */ + @JsonProperty(value = "cloudCapacity", access = JsonProperty.Access.WRITE_ONLY) + private CloudCapacity cloudCapacity; + + /* + * List of QoS policies available for the cloud. + */ + @JsonProperty(value = "storageQoSPolicies", access = JsonProperty.Access.WRITE_ONLY) + private List storageQoSPolicies; + + /* + * Gets or sets the provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @return the inventoryItemId value. + */ + public String inventoryItemId() { + return this.inventoryItemId; + } + + /** + * Set the inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @param inventoryItemId the inventoryItemId value to set. + * @return the CloudProperties object itself. + */ + public CloudProperties withInventoryItemId(String inventoryItemId) { + this.inventoryItemId = inventoryItemId; + return this; + } + + /** + * Get the uuid property: Unique ID of the cloud. + * + * @return the uuid value. + */ + public String uuid() { + return this.uuid; + } + + /** + * Set the uuid property: Unique ID of the cloud. + * + * @param uuid the uuid value to set. + * @return the CloudProperties object itself. + */ + public CloudProperties withUuid(String uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @return the vmmServerId value. + */ + public String vmmServerId() { + return this.vmmServerId; + } + + /** + * Set the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @param vmmServerId the vmmServerId value to set. + * @return the CloudProperties object itself. + */ + public CloudProperties withVmmServerId(String vmmServerId) { + this.vmmServerId = vmmServerId; + return this; + } + + /** + * Get the cloudName property: Name of the cloud in VMMServer. + * + * @return the cloudName value. + */ + public String cloudName() { + return this.cloudName; + } + + /** + * Get the cloudCapacity property: Capacity of the cloud. + * + * @return the cloudCapacity value. + */ + public CloudCapacity cloudCapacity() { + return this.cloudCapacity; + } + + /** + * Get the storageQoSPolicies property: List of QoS policies available for the cloud. + * + * @return the storageQoSPolicies value. + */ + public List storageQoSPolicies() { + return this.storageQoSPolicies; + } + + /** + * Get the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (cloudCapacity() != null) { + cloudCapacity().validate(); + } + if (storageQoSPolicies() != null) { + storageQoSPolicies().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/InventoryItemInner.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/InventoryItemInner.java new file mode 100644 index 0000000000000..b41488e2dd7d1 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/InventoryItemInner.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.scvmm.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the inventory item. */ +@Fluent +public final class InventoryItemInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties", required = true) + private InventoryItemProperties innerProperties = new InventoryItemProperties(); + + /* + * The system data. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Metadata used by portal/tooling/etc to render different UX experiences + * for resources of the same type; e.g. ApiApps are a kind of + * Microsoft.Web/sites type. If supported, the resource provider must + * validate and persist this value. + */ + @JsonProperty(value = "kind") + private String kind; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private InventoryItemProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: The system data. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the kind property: Metadata used by portal/tooling/etc to render different UX experiences for resources of + * the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must + * validate and persist this value. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind property: Metadata used by portal/tooling/etc to render different UX experiences for resources of + * the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must + * validate and persist this value. + * + * @param kind the kind value to set. + * @return the InventoryItemInner object itself. + */ + public InventoryItemInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get the managedResourceId property: Gets the tracked resource id corresponding to the inventory resource. + * + * @return the managedResourceId value. + */ + public String managedResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().managedResourceId(); + } + + /** + * Get the uuid property: Gets the UUID (which is assigned by VMM) for the inventory item. + * + * @return the uuid value. + */ + public String uuid() { + return this.innerProperties() == null ? null : this.innerProperties().uuid(); + } + + /** + * Get the inventoryItemName property: Gets the Managed Object name in VMM for the inventory item. + * + * @return the inventoryItemName value. + */ + public String inventoryItemName() { + return this.innerProperties() == null ? null : this.innerProperties().inventoryItemName(); + } + + /** + * Get the provisioningState property: Gets the provisioning state. + * + * @return the provisioningState value. + */ + public String 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model InventoryItemInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(InventoryItemInner.class); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/InventoryItemProperties.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/InventoryItemProperties.java new file mode 100644 index 0000000000000..7a5297045502f --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/InventoryItemProperties.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.scvmm.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.scvmm.models.CloudInventoryItem; +import com.azure.resourcemanager.scvmm.models.VirtualMachineInventoryItem; +import com.azure.resourcemanager.scvmm.models.VirtualMachineTemplateInventoryItem; +import com.azure.resourcemanager.scvmm.models.VirtualNetworkInventoryItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Defines the resource properties. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "inventoryType", + defaultImpl = InventoryItemProperties.class) +@JsonTypeName("InventoryItemProperties") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Cloud", value = CloudInventoryItem.class), + @JsonSubTypes.Type(name = "VirtualNetwork", value = VirtualNetworkInventoryItem.class), + @JsonSubTypes.Type(name = "VirtualMachineTemplate", value = VirtualMachineTemplateInventoryItem.class), + @JsonSubTypes.Type(name = "VirtualMachine", value = VirtualMachineInventoryItem.class) +}) +@Immutable +public class InventoryItemProperties { + /* + * Gets the tracked resource id corresponding to the inventory resource. + */ + @JsonProperty(value = "managedResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String managedResourceId; + + /* + * Gets the UUID (which is assigned by VMM) for the inventory item. + */ + @JsonProperty(value = "uuid", access = JsonProperty.Access.WRITE_ONLY) + private String uuid; + + /* + * Gets the Managed Object name in VMM for the inventory item. + */ + @JsonProperty(value = "inventoryItemName", access = JsonProperty.Access.WRITE_ONLY) + private String inventoryItemName; + + /* + * Gets the provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the managedResourceId property: Gets the tracked resource id corresponding to the inventory resource. + * + * @return the managedResourceId value. + */ + public String managedResourceId() { + return this.managedResourceId; + } + + /** + * Get the uuid property: Gets the UUID (which is assigned by VMM) for the inventory item. + * + * @return the uuid value. + */ + public String uuid() { + return this.uuid; + } + + /** + * Get the inventoryItemName property: Gets the Managed Object name in VMM for the inventory item. + * + * @return the inventoryItemName value. + */ + public String inventoryItemName() { + return this.inventoryItemName; + } + + /** + * Get the provisioningState property: Gets the provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/ResourceProviderOperationInner.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/ResourceProviderOperationInner.java new file mode 100644 index 0000000000000..079a06ef5c788 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/ResourceProviderOperationInner.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.scvmm.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.scvmm.models.ResourceProviderOperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Results of the request to list operations. */ +@Fluent +public final class ResourceProviderOperationInner { + /* + * Indicates whether the operation applies to data-plane. + */ + @JsonProperty(value = "isDataAction") + private String isDataAction; + + /* + * Operation name, in format of {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Display metadata associated with the operation. + */ + @JsonProperty(value = "display") + private ResourceProviderOperationDisplay display; + + /** + * Get the isDataAction property: Indicates whether the operation applies to data-plane. + * + * @return the isDataAction value. + */ + public String isDataAction() { + return this.isDataAction; + } + + /** + * Set the isDataAction property: Indicates whether the operation applies to data-plane. + * + * @param isDataAction the isDataAction value to set. + * @return the ResourceProviderOperationInner object itself. + */ + public ResourceProviderOperationInner withIsDataAction(String isDataAction) { + this.isDataAction = isDataAction; + return this; + } + + /** + * Get the name property: Operation name, in format of {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Operation name, in format of {provider}/{resource}/{operation}. + * + * @param name the name value to set. + * @return the ResourceProviderOperationInner object itself. + */ + public ResourceProviderOperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: Display metadata associated with the operation. + * + * @return the display value. + */ + public ResourceProviderOperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Display metadata associated with the operation. + * + * @param display the display value to set. + * @return the ResourceProviderOperationInner object itself. + */ + public ResourceProviderOperationInner withDisplay(ResourceProviderOperationDisplay display) { + this.display = display; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VirtualMachineInner.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VirtualMachineInner.java new file mode 100644 index 0000000000000..1ad3a83421bde --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VirtualMachineInner.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.scvmm.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.scvmm.models.AvailabilitySetListItem; +import com.azure.resourcemanager.scvmm.models.Checkpoint; +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; +import com.azure.resourcemanager.scvmm.models.HardwareProfile; +import com.azure.resourcemanager.scvmm.models.NetworkProfile; +import com.azure.resourcemanager.scvmm.models.OsProfile; +import com.azure.resourcemanager.scvmm.models.StorageProfile; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The VirtualMachines resource definition. */ +@Fluent +public final class VirtualMachineInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties", required = true) + private VirtualMachineProperties innerProperties = new VirtualMachineProperties(); + + /* + * The system data. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The extended location. + */ + @JsonProperty(value = "extendedLocation", required = true) + private ExtendedLocation extendedLocation; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private VirtualMachineProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: The system data. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the extendedLocation property: The extended location. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extended location. + * + * @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 inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @return the inventoryItemId value. + */ + public String inventoryItemId() { + return this.innerProperties() == null ? null : this.innerProperties().inventoryItemId(); + } + + /** + * Set the inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @param inventoryItemId the inventoryItemId value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withInventoryItemId(String inventoryItemId) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineProperties(); + } + this.innerProperties().withInventoryItemId(inventoryItemId); + return this; + } + + /** + * Get the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @return the vmmServerId value. + */ + public String vmmServerId() { + return this.innerProperties() == null ? null : this.innerProperties().vmmServerId(); + } + + /** + * Set the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @param vmmServerId the vmmServerId value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withVmmServerId(String vmmServerId) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineProperties(); + } + this.innerProperties().withVmmServerId(vmmServerId); + return this; + } + + /** + * Get the cloudId property: ARM Id of the cloud resource to use for deploying the vm. + * + * @return the cloudId value. + */ + public String cloudId() { + return this.innerProperties() == null ? null : this.innerProperties().cloudId(); + } + + /** + * Set the cloudId property: ARM Id of the cloud resource to use for deploying the vm. + * + * @param cloudId the cloudId value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withCloudId(String cloudId) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineProperties(); + } + this.innerProperties().withCloudId(cloudId); + return this; + } + + /** + * Get the templateId property: ARM Id of the template resource to use for deploying the vm. + * + * @return the templateId value. + */ + public String templateId() { + return this.innerProperties() == null ? null : this.innerProperties().templateId(); + } + + /** + * Set the templateId property: ARM Id of the template resource to use for deploying the vm. + * + * @param templateId the templateId value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withTemplateId(String templateId) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineProperties(); + } + this.innerProperties().withTemplateId(templateId); + return this; + } + + /** + * Get the checkpointType property: Type of checkpoint supported for the vm. + * + * @return the checkpointType value. + */ + public String checkpointType() { + return this.innerProperties() == null ? null : this.innerProperties().checkpointType(); + } + + /** + * Set the checkpointType property: Type of checkpoint supported for the vm. + * + * @param checkpointType the checkpointType value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withCheckpointType(String checkpointType) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineProperties(); + } + this.innerProperties().withCheckpointType(checkpointType); + return this; + } + + /** + * Get the checkpoints property: Checkpoints in the vm. + * + * @return the checkpoints value. + */ + public List checkpoints() { + return this.innerProperties() == null ? null : this.innerProperties().checkpoints(); + } + + /** + * Set the checkpoints property: Checkpoints in the vm. + * + * @param checkpoints the checkpoints value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withCheckpoints(List checkpoints) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineProperties(); + } + this.innerProperties().withCheckpoints(checkpoints); + return this; + } + + /** + * Get the availabilitySets property: Availability Sets in vm. + * + * @return the availabilitySets value. + */ + public List availabilitySets() { + return this.innerProperties() == null ? null : this.innerProperties().availabilitySets(); + } + + /** + * Set the availabilitySets property: Availability Sets in vm. + * + * @param availabilitySets the availabilitySets value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withAvailabilitySets(List availabilitySets) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineProperties(); + } + this.innerProperties().withAvailabilitySets(availabilitySets); + return this; + } + + /** + * Get the osProfile property: OS properties. + * + * @return the osProfile value. + */ + public OsProfile osProfile() { + return this.innerProperties() == null ? null : this.innerProperties().osProfile(); + } + + /** + * Set the osProfile property: OS properties. + * + * @param osProfile the osProfile value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withOsProfile(OsProfile osProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineProperties(); + } + this.innerProperties().withOsProfile(osProfile); + return this; + } + + /** + * Get the hardwareProfile property: Hardware properties. + * + * @return the hardwareProfile value. + */ + public HardwareProfile hardwareProfile() { + return this.innerProperties() == null ? null : this.innerProperties().hardwareProfile(); + } + + /** + * Set the hardwareProfile property: Hardware properties. + * + * @param hardwareProfile the hardwareProfile value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withHardwareProfile(HardwareProfile hardwareProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineProperties(); + } + this.innerProperties().withHardwareProfile(hardwareProfile); + return this; + } + + /** + * Get the networkProfile property: Network properties. + * + * @return the networkProfile value. + */ + public NetworkProfile networkProfile() { + return this.innerProperties() == null ? null : this.innerProperties().networkProfile(); + } + + /** + * Set the networkProfile property: Network properties. + * + * @param networkProfile the networkProfile value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withNetworkProfile(NetworkProfile networkProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineProperties(); + } + this.innerProperties().withNetworkProfile(networkProfile); + return this; + } + + /** + * Get the storageProfile property: Storage properties. + * + * @return the storageProfile value. + */ + public StorageProfile storageProfile() { + return this.innerProperties() == null ? null : this.innerProperties().storageProfile(); + } + + /** + * Set the storageProfile property: Storage properties. + * + * @param storageProfile the storageProfile value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withStorageProfile(StorageProfile storageProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineProperties(); + } + this.innerProperties().withStorageProfile(storageProfile); + return this; + } + + /** + * Get the vmName property: VMName is the name of VM on the SCVMM server. + * + * @return the vmName value. + */ + public String vmName() { + return this.innerProperties() == null ? null : this.innerProperties().vmName(); + } + + /** + * Set the vmName property: VMName is the name of VM on the SCVMM server. + * + * @param vmName the vmName value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withVmName(String vmName) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineProperties(); + } + this.innerProperties().withVmName(vmName); + return this; + } + + /** + * Get the uuid property: Unique ID of the virtual machine. + * + * @return the uuid value. + */ + public String uuid() { + return this.innerProperties() == null ? null : this.innerProperties().uuid(); + } + + /** + * Set the uuid property: Unique ID of the virtual machine. + * + * @param uuid the uuid value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withUuid(String uuid) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineProperties(); + } + this.innerProperties().withUuid(uuid); + return this; + } + + /** + * Get the generation property: Gets or sets the generation for the vm. + * + * @return the generation value. + */ + public Integer generation() { + return this.innerProperties() == null ? null : this.innerProperties().generation(); + } + + /** + * Set the generation property: Gets or sets the generation for the vm. + * + * @param generation the generation value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withGeneration(Integer generation) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineProperties(); + } + this.innerProperties().withGeneration(generation); + return this; + } + + /** + * Get the powerState property: Gets the power state of the virtual machine. + * + * @return the powerState value. + */ + public String powerState() { + return this.innerProperties() == null ? null : this.innerProperties().powerState(); + } + + /** + * Get the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + public String 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model VirtualMachineInner")); + } else { + innerProperties().validate(); + } + if (extendedLocation() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property extendedLocation in model VirtualMachineInner")); + } else { + extendedLocation().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualMachineInner.class); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VirtualMachineProperties.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VirtualMachineProperties.java new file mode 100644 index 0000000000000..842675b918287 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VirtualMachineProperties.java @@ -0,0 +1,439 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.scvmm.models.AvailabilitySetListItem; +import com.azure.resourcemanager.scvmm.models.Checkpoint; +import com.azure.resourcemanager.scvmm.models.HardwareProfile; +import com.azure.resourcemanager.scvmm.models.NetworkProfile; +import com.azure.resourcemanager.scvmm.models.OsProfile; +import com.azure.resourcemanager.scvmm.models.StorageProfile; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Defines the resource properties. */ +@Fluent +public final class VirtualMachineProperties { + /* + * Gets or sets the inventory Item ID for the resource. + */ + @JsonProperty(value = "inventoryItemId") + private String inventoryItemId; + + /* + * ARM Id of the vmmServer resource in which this resource resides. + */ + @JsonProperty(value = "vmmServerId") + private String vmmServerId; + + /* + * ARM Id of the cloud resource to use for deploying the vm. + */ + @JsonProperty(value = "cloudId") + private String cloudId; + + /* + * ARM Id of the template resource to use for deploying the vm. + */ + @JsonProperty(value = "templateId") + private String templateId; + + /* + * Type of checkpoint supported for the vm. + */ + @JsonProperty(value = "checkpointType") + private String checkpointType; + + /* + * Checkpoints in the vm. + */ + @JsonProperty(value = "checkpoints") + private List checkpoints; + + /* + * Availability Sets in vm. + */ + @JsonProperty(value = "availabilitySets") + private List availabilitySets; + + /* + * OS properties. + */ + @JsonProperty(value = "osProfile") + private OsProfile osProfile; + + /* + * Hardware properties. + */ + @JsonProperty(value = "hardwareProfile") + private HardwareProfile hardwareProfile; + + /* + * Network properties. + */ + @JsonProperty(value = "networkProfile") + private NetworkProfile networkProfile; + + /* + * Storage properties. + */ + @JsonProperty(value = "storageProfile") + private StorageProfile storageProfile; + + /* + * VMName is the name of VM on the SCVMM server. + */ + @JsonProperty(value = "vmName") + private String vmName; + + /* + * Unique ID of the virtual machine. + */ + @JsonProperty(value = "uuid") + private String uuid; + + /* + * Gets or sets the generation for the vm. + */ + @JsonProperty(value = "generation") + private Integer generation; + + /* + * Gets the power state of the virtual machine. + */ + @JsonProperty(value = "powerState", access = JsonProperty.Access.WRITE_ONLY) + private String powerState; + + /* + * Gets or sets the provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @return the inventoryItemId value. + */ + public String inventoryItemId() { + return this.inventoryItemId; + } + + /** + * Set the inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @param inventoryItemId the inventoryItemId value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withInventoryItemId(String inventoryItemId) { + this.inventoryItemId = inventoryItemId; + return this; + } + + /** + * Get the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @return the vmmServerId value. + */ + public String vmmServerId() { + return this.vmmServerId; + } + + /** + * Set the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @param vmmServerId the vmmServerId value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withVmmServerId(String vmmServerId) { + this.vmmServerId = vmmServerId; + return this; + } + + /** + * Get the cloudId property: ARM Id of the cloud resource to use for deploying the vm. + * + * @return the cloudId value. + */ + public String cloudId() { + return this.cloudId; + } + + /** + * Set the cloudId property: ARM Id of the cloud resource to use for deploying the vm. + * + * @param cloudId the cloudId value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withCloudId(String cloudId) { + this.cloudId = cloudId; + return this; + } + + /** + * Get the templateId property: ARM Id of the template resource to use for deploying the vm. + * + * @return the templateId value. + */ + public String templateId() { + return this.templateId; + } + + /** + * Set the templateId property: ARM Id of the template resource to use for deploying the vm. + * + * @param templateId the templateId value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + /** + * Get the checkpointType property: Type of checkpoint supported for the vm. + * + * @return the checkpointType value. + */ + public String checkpointType() { + return this.checkpointType; + } + + /** + * Set the checkpointType property: Type of checkpoint supported for the vm. + * + * @param checkpointType the checkpointType value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withCheckpointType(String checkpointType) { + this.checkpointType = checkpointType; + return this; + } + + /** + * Get the checkpoints property: Checkpoints in the vm. + * + * @return the checkpoints value. + */ + public List checkpoints() { + return this.checkpoints; + } + + /** + * Set the checkpoints property: Checkpoints in the vm. + * + * @param checkpoints the checkpoints value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withCheckpoints(List checkpoints) { + this.checkpoints = checkpoints; + return this; + } + + /** + * Get the availabilitySets property: Availability Sets in vm. + * + * @return the availabilitySets value. + */ + public List availabilitySets() { + return this.availabilitySets; + } + + /** + * Set the availabilitySets property: Availability Sets in vm. + * + * @param availabilitySets the availabilitySets value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withAvailabilitySets(List availabilitySets) { + this.availabilitySets = availabilitySets; + return this; + } + + /** + * Get the osProfile property: OS properties. + * + * @return the osProfile value. + */ + public OsProfile osProfile() { + return this.osProfile; + } + + /** + * Set the osProfile property: OS properties. + * + * @param osProfile the osProfile value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withOsProfile(OsProfile osProfile) { + this.osProfile = osProfile; + return this; + } + + /** + * Get the hardwareProfile property: Hardware properties. + * + * @return the hardwareProfile value. + */ + public HardwareProfile hardwareProfile() { + return this.hardwareProfile; + } + + /** + * Set the hardwareProfile property: Hardware properties. + * + * @param hardwareProfile the hardwareProfile value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withHardwareProfile(HardwareProfile hardwareProfile) { + this.hardwareProfile = hardwareProfile; + return this; + } + + /** + * Get the networkProfile property: Network properties. + * + * @return the networkProfile value. + */ + public NetworkProfile networkProfile() { + return this.networkProfile; + } + + /** + * Set the networkProfile property: Network properties. + * + * @param networkProfile the networkProfile value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withNetworkProfile(NetworkProfile networkProfile) { + this.networkProfile = networkProfile; + return this; + } + + /** + * Get the storageProfile property: Storage properties. + * + * @return the storageProfile value. + */ + public StorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile property: Storage properties. + * + * @param storageProfile the storageProfile value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withStorageProfile(StorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get the vmName property: VMName is the name of VM on the SCVMM server. + * + * @return the vmName value. + */ + public String vmName() { + return this.vmName; + } + + /** + * Set the vmName property: VMName is the name of VM on the SCVMM server. + * + * @param vmName the vmName value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withVmName(String vmName) { + this.vmName = vmName; + return this; + } + + /** + * Get the uuid property: Unique ID of the virtual machine. + * + * @return the uuid value. + */ + public String uuid() { + return this.uuid; + } + + /** + * Set the uuid property: Unique ID of the virtual machine. + * + * @param uuid the uuid value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withUuid(String uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get the generation property: Gets or sets the generation for the vm. + * + * @return the generation value. + */ + public Integer generation() { + return this.generation; + } + + /** + * Set the generation property: Gets or sets the generation for the vm. + * + * @param generation the generation value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withGeneration(Integer generation) { + this.generation = generation; + return this; + } + + /** + * Get the powerState property: Gets the power state of the virtual machine. + * + * @return the powerState value. + */ + public String powerState() { + return this.powerState; + } + + /** + * Get the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (checkpoints() != null) { + checkpoints().forEach(e -> e.validate()); + } + if (availabilitySets() != null) { + availabilitySets().forEach(e -> e.validate()); + } + if (osProfile() != null) { + osProfile().validate(); + } + if (hardwareProfile() != null) { + hardwareProfile().validate(); + } + if (networkProfile() != null) { + networkProfile().validate(); + } + if (storageProfile() != null) { + storageProfile().validate(); + } + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VirtualMachineTemplateInner.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VirtualMachineTemplateInner.java new file mode 100644 index 0000000000000..780727522e47d --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VirtualMachineTemplateInner.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.scvmm.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.scvmm.models.DynamicMemoryEnabled; +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; +import com.azure.resourcemanager.scvmm.models.IsCustomizable; +import com.azure.resourcemanager.scvmm.models.LimitCpuForMigration; +import com.azure.resourcemanager.scvmm.models.NetworkInterfaces; +import com.azure.resourcemanager.scvmm.models.OsType; +import com.azure.resourcemanager.scvmm.models.VirtualDisk; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The VirtualMachineTemplates resource definition. */ +@Fluent +public final class VirtualMachineTemplateInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties", required = true) + private VirtualMachineTemplateProperties innerProperties = new VirtualMachineTemplateProperties(); + + /* + * The system data. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The extended location. + */ + @JsonProperty(value = "extendedLocation", required = true) + private ExtendedLocation extendedLocation; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private VirtualMachineTemplateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: The system data. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the extendedLocation property: The extended location. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extended location. + * + * @param extendedLocation the extendedLocation value to set. + * @return the VirtualMachineTemplateInner object itself. + */ + public VirtualMachineTemplateInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineTemplateInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineTemplateInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @return the inventoryItemId value. + */ + public String inventoryItemId() { + return this.innerProperties() == null ? null : this.innerProperties().inventoryItemId(); + } + + /** + * Set the inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @param inventoryItemId the inventoryItemId value to set. + * @return the VirtualMachineTemplateInner object itself. + */ + public VirtualMachineTemplateInner withInventoryItemId(String inventoryItemId) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineTemplateProperties(); + } + this.innerProperties().withInventoryItemId(inventoryItemId); + return this; + } + + /** + * Get the uuid property: Unique ID of the virtual machine template. + * + * @return the uuid value. + */ + public String uuid() { + return this.innerProperties() == null ? null : this.innerProperties().uuid(); + } + + /** + * Set the uuid property: Unique ID of the virtual machine template. + * + * @param uuid the uuid value to set. + * @return the VirtualMachineTemplateInner object itself. + */ + public VirtualMachineTemplateInner withUuid(String uuid) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineTemplateProperties(); + } + this.innerProperties().withUuid(uuid); + return this; + } + + /** + * Get the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @return the vmmServerId value. + */ + public String vmmServerId() { + return this.innerProperties() == null ? null : this.innerProperties().vmmServerId(); + } + + /** + * Set the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @param vmmServerId the vmmServerId value to set. + * @return the VirtualMachineTemplateInner object itself. + */ + public VirtualMachineTemplateInner withVmmServerId(String vmmServerId) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineTemplateProperties(); + } + this.innerProperties().withVmmServerId(vmmServerId); + return this; + } + + /** + * Get the osType property: Gets or sets the type of the os. + * + * @return the osType value. + */ + public OsType osType() { + return this.innerProperties() == null ? null : this.innerProperties().osType(); + } + + /** + * Get the osName property: Gets or sets os name. + * + * @return the osName value. + */ + public String osName() { + return this.innerProperties() == null ? null : this.innerProperties().osName(); + } + + /** + * Get the computerName property: Gets or sets computer name. + * + * @return the computerName value. + */ + public String computerName() { + return this.innerProperties() == null ? null : this.innerProperties().computerName(); + } + + /** + * Get the memoryMB property: MemoryMB is the desired size of a virtual machine's memory, in MB. + * + * @return the memoryMB value. + */ + public Integer memoryMB() { + return this.innerProperties() == null ? null : this.innerProperties().memoryMB(); + } + + /** + * Get the cpuCount property: Gets or sets the desired number of vCPUs for the vm. + * + * @return the cpuCount value. + */ + public Integer cpuCount() { + return this.innerProperties() == null ? null : this.innerProperties().cpuCount(); + } + + /** + * Get the limitCpuForMigration property: Gets or sets a value indicating whether to enable processor compatibility + * mode for live migration of VMs. + * + * @return the limitCpuForMigration value. + */ + public LimitCpuForMigration limitCpuForMigration() { + return this.innerProperties() == null ? null : this.innerProperties().limitCpuForMigration(); + } + + /** + * Get the dynamicMemoryEnabled property: Gets or sets a value indicating whether to enable dynamic memory or not. + * + * @return the dynamicMemoryEnabled value. + */ + public DynamicMemoryEnabled dynamicMemoryEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().dynamicMemoryEnabled(); + } + + /** + * Get the isCustomizable property: Gets or sets a value indicating whether the vm template is customizable or not. + * + * @return the isCustomizable value. + */ + public IsCustomizable isCustomizable() { + return this.innerProperties() == null ? null : this.innerProperties().isCustomizable(); + } + + /** + * Get the dynamicMemoryMaxMB property: Gets or sets the max dynamic memory for the vm. + * + * @return the dynamicMemoryMaxMB value. + */ + public Integer dynamicMemoryMaxMB() { + return this.innerProperties() == null ? null : this.innerProperties().dynamicMemoryMaxMB(); + } + + /** + * Get the dynamicMemoryMinMB property: Gets or sets the min dynamic memory for the vm. + * + * @return the dynamicMemoryMinMB value. + */ + public Integer dynamicMemoryMinMB() { + return this.innerProperties() == null ? null : this.innerProperties().dynamicMemoryMinMB(); + } + + /** + * Get the isHighlyAvailable property: Gets highly available property. + * + * @return the isHighlyAvailable value. + */ + public String isHighlyAvailable() { + return this.innerProperties() == null ? null : this.innerProperties().isHighlyAvailable(); + } + + /** + * Get the generation property: Gets or sets the generation for the vm. + * + * @return the generation value. + */ + public Integer generation() { + return this.innerProperties() == null ? null : this.innerProperties().generation(); + } + + /** + * Get the networkInterfaces property: Gets or sets the network interfaces of the template. + * + * @return the networkInterfaces value. + */ + public List networkInterfaces() { + return this.innerProperties() == null ? null : this.innerProperties().networkInterfaces(); + } + + /** + * Get the disks property: Gets or sets the disks of the template. + * + * @return the disks value. + */ + public List disks() { + return this.innerProperties() == null ? null : this.innerProperties().disks(); + } + + /** + * Get the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + public String 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model VirtualMachineTemplateInner")); + } else { + innerProperties().validate(); + } + if (extendedLocation() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property extendedLocation in model VirtualMachineTemplateInner")); + } else { + extendedLocation().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualMachineTemplateInner.class); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VirtualMachineTemplateProperties.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VirtualMachineTemplateProperties.java new file mode 100644 index 0000000000000..017bbce09cfee --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VirtualMachineTemplateProperties.java @@ -0,0 +1,339 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.scvmm.models.DynamicMemoryEnabled; +import com.azure.resourcemanager.scvmm.models.IsCustomizable; +import com.azure.resourcemanager.scvmm.models.LimitCpuForMigration; +import com.azure.resourcemanager.scvmm.models.NetworkInterfaces; +import com.azure.resourcemanager.scvmm.models.OsType; +import com.azure.resourcemanager.scvmm.models.VirtualDisk; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Defines the resource properties. */ +@Fluent +public final class VirtualMachineTemplateProperties { + /* + * Gets or sets the inventory Item ID for the resource. + */ + @JsonProperty(value = "inventoryItemId") + private String inventoryItemId; + + /* + * Unique ID of the virtual machine template. + */ + @JsonProperty(value = "uuid") + private String uuid; + + /* + * ARM Id of the vmmServer resource in which this resource resides. + */ + @JsonProperty(value = "vmmServerId") + private String vmmServerId; + + /* + * Gets or sets the type of the os. + */ + @JsonProperty(value = "osType", access = JsonProperty.Access.WRITE_ONLY) + private OsType osType; + + /* + * Gets or sets os name. + */ + @JsonProperty(value = "osName", access = JsonProperty.Access.WRITE_ONLY) + private String osName; + + /* + * Gets or sets computer name. + */ + @JsonProperty(value = "computerName", access = JsonProperty.Access.WRITE_ONLY) + private String computerName; + + /* + * MemoryMB is the desired size of a virtual machine's memory, in MB. + */ + @JsonProperty(value = "memoryMB", access = JsonProperty.Access.WRITE_ONLY) + private Integer memoryMB; + + /* + * Gets or sets the desired number of vCPUs for the vm. + */ + @JsonProperty(value = "cpuCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer cpuCount; + + /* + * Gets or sets a value indicating whether to enable processor + * compatibility mode for live migration of VMs. + */ + @JsonProperty(value = "limitCpuForMigration", access = JsonProperty.Access.WRITE_ONLY) + private LimitCpuForMigration limitCpuForMigration; + + /* + * Gets or sets a value indicating whether to enable dynamic memory or not. + */ + @JsonProperty(value = "dynamicMemoryEnabled", access = JsonProperty.Access.WRITE_ONLY) + private DynamicMemoryEnabled dynamicMemoryEnabled; + + /* + * Gets or sets a value indicating whether the vm template is customizable + * or not. + */ + @JsonProperty(value = "isCustomizable", access = JsonProperty.Access.WRITE_ONLY) + private IsCustomizable isCustomizable; + + /* + * Gets or sets the max dynamic memory for the vm. + */ + @JsonProperty(value = "dynamicMemoryMaxMB", access = JsonProperty.Access.WRITE_ONLY) + private Integer dynamicMemoryMaxMB; + + /* + * Gets or sets the min dynamic memory for the vm. + */ + @JsonProperty(value = "dynamicMemoryMinMB", access = JsonProperty.Access.WRITE_ONLY) + private Integer dynamicMemoryMinMB; + + /* + * Gets highly available property. + */ + @JsonProperty(value = "isHighlyAvailable", access = JsonProperty.Access.WRITE_ONLY) + private String isHighlyAvailable; + + /* + * Gets or sets the generation for the vm. + */ + @JsonProperty(value = "generation", access = JsonProperty.Access.WRITE_ONLY) + private Integer generation; + + /* + * Gets or sets the network interfaces of the template. + */ + @JsonProperty(value = "networkInterfaces", access = JsonProperty.Access.WRITE_ONLY) + private List networkInterfaces; + + /* + * Gets or sets the disks of the template. + */ + @JsonProperty(value = "disks", access = JsonProperty.Access.WRITE_ONLY) + private List disks; + + /* + * Gets or sets the provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @return the inventoryItemId value. + */ + public String inventoryItemId() { + return this.inventoryItemId; + } + + /** + * Set the inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @param inventoryItemId the inventoryItemId value to set. + * @return the VirtualMachineTemplateProperties object itself. + */ + public VirtualMachineTemplateProperties withInventoryItemId(String inventoryItemId) { + this.inventoryItemId = inventoryItemId; + return this; + } + + /** + * Get the uuid property: Unique ID of the virtual machine template. + * + * @return the uuid value. + */ + public String uuid() { + return this.uuid; + } + + /** + * Set the uuid property: Unique ID of the virtual machine template. + * + * @param uuid the uuid value to set. + * @return the VirtualMachineTemplateProperties object itself. + */ + public VirtualMachineTemplateProperties withUuid(String uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @return the vmmServerId value. + */ + public String vmmServerId() { + return this.vmmServerId; + } + + /** + * Set the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @param vmmServerId the vmmServerId value to set. + * @return the VirtualMachineTemplateProperties object itself. + */ + public VirtualMachineTemplateProperties withVmmServerId(String vmmServerId) { + this.vmmServerId = vmmServerId; + return this; + } + + /** + * Get the osType property: Gets or sets the type of the os. + * + * @return the osType value. + */ + public OsType osType() { + return this.osType; + } + + /** + * Get the osName property: Gets or sets os name. + * + * @return the osName value. + */ + public String osName() { + return this.osName; + } + + /** + * Get the computerName property: Gets or sets computer name. + * + * @return the computerName value. + */ + public String computerName() { + return this.computerName; + } + + /** + * Get the memoryMB property: MemoryMB is the desired size of a virtual machine's memory, in MB. + * + * @return the memoryMB value. + */ + public Integer memoryMB() { + return this.memoryMB; + } + + /** + * Get the cpuCount property: Gets or sets the desired number of vCPUs for the vm. + * + * @return the cpuCount value. + */ + public Integer cpuCount() { + return this.cpuCount; + } + + /** + * Get the limitCpuForMigration property: Gets or sets a value indicating whether to enable processor compatibility + * mode for live migration of VMs. + * + * @return the limitCpuForMigration value. + */ + public LimitCpuForMigration limitCpuForMigration() { + return this.limitCpuForMigration; + } + + /** + * Get the dynamicMemoryEnabled property: Gets or sets a value indicating whether to enable dynamic memory or not. + * + * @return the dynamicMemoryEnabled value. + */ + public DynamicMemoryEnabled dynamicMemoryEnabled() { + return this.dynamicMemoryEnabled; + } + + /** + * Get the isCustomizable property: Gets or sets a value indicating whether the vm template is customizable or not. + * + * @return the isCustomizable value. + */ + public IsCustomizable isCustomizable() { + return this.isCustomizable; + } + + /** + * Get the dynamicMemoryMaxMB property: Gets or sets the max dynamic memory for the vm. + * + * @return the dynamicMemoryMaxMB value. + */ + public Integer dynamicMemoryMaxMB() { + return this.dynamicMemoryMaxMB; + } + + /** + * Get the dynamicMemoryMinMB property: Gets or sets the min dynamic memory for the vm. + * + * @return the dynamicMemoryMinMB value. + */ + public Integer dynamicMemoryMinMB() { + return this.dynamicMemoryMinMB; + } + + /** + * Get the isHighlyAvailable property: Gets highly available property. + * + * @return the isHighlyAvailable value. + */ + public String isHighlyAvailable() { + return this.isHighlyAvailable; + } + + /** + * Get the generation property: Gets or sets the generation for the vm. + * + * @return the generation value. + */ + public Integer generation() { + return this.generation; + } + + /** + * Get the networkInterfaces property: Gets or sets the network interfaces of the template. + * + * @return the networkInterfaces value. + */ + public List networkInterfaces() { + return this.networkInterfaces; + } + + /** + * Get the disks property: Gets or sets the disks of the template. + * + * @return the disks value. + */ + public List disks() { + return this.disks; + } + + /** + * Get the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (networkInterfaces() != null) { + networkInterfaces().forEach(e -> e.validate()); + } + if (disks() != null) { + disks().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VirtualNetworkInner.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VirtualNetworkInner.java new file mode 100644 index 0000000000000..6dbe4933b3545 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VirtualNetworkInner.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.scvmm.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The VirtualNetworks resource definition. */ +@Fluent +public final class VirtualNetworkInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties", required = true) + private VirtualNetworkProperties innerProperties = new VirtualNetworkProperties(); + + /* + * The system data. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The extended location. + */ + @JsonProperty(value = "extendedLocation", required = true) + private ExtendedLocation extendedLocation; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private VirtualNetworkProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: The system data. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the extendedLocation property: The extended location. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extended location. + * + * @param extendedLocation the extendedLocation value to set. + * @return the VirtualNetworkInner object itself. + */ + public VirtualNetworkInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualNetworkInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualNetworkInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @return the inventoryItemId value. + */ + public String inventoryItemId() { + return this.innerProperties() == null ? null : this.innerProperties().inventoryItemId(); + } + + /** + * Set the inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @param inventoryItemId the inventoryItemId value to set. + * @return the VirtualNetworkInner object itself. + */ + public VirtualNetworkInner withInventoryItemId(String inventoryItemId) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualNetworkProperties(); + } + this.innerProperties().withInventoryItemId(inventoryItemId); + return this; + } + + /** + * Get the uuid property: Unique ID of the virtual network. + * + * @return the uuid value. + */ + public String uuid() { + return this.innerProperties() == null ? null : this.innerProperties().uuid(); + } + + /** + * Set the uuid property: Unique ID of the virtual network. + * + * @param uuid the uuid value to set. + * @return the VirtualNetworkInner object itself. + */ + public VirtualNetworkInner withUuid(String uuid) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualNetworkProperties(); + } + this.innerProperties().withUuid(uuid); + return this; + } + + /** + * Get the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @return the vmmServerId value. + */ + public String vmmServerId() { + return this.innerProperties() == null ? null : this.innerProperties().vmmServerId(); + } + + /** + * Set the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @param vmmServerId the vmmServerId value to set. + * @return the VirtualNetworkInner object itself. + */ + public VirtualNetworkInner withVmmServerId(String vmmServerId) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualNetworkProperties(); + } + this.innerProperties().withVmmServerId(vmmServerId); + return this; + } + + /** + * Get the networkName property: Name of the virtual network in vmmServer. + * + * @return the networkName value. + */ + public String networkName() { + return this.innerProperties() == null ? null : this.innerProperties().networkName(); + } + + /** + * Get the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + public String 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model VirtualNetworkInner")); + } else { + innerProperties().validate(); + } + if (extendedLocation() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property extendedLocation in model VirtualNetworkInner")); + } else { + extendedLocation().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualNetworkInner.class); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VirtualNetworkProperties.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VirtualNetworkProperties.java new file mode 100644 index 0000000000000..edb26c1410650 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VirtualNetworkProperties.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.scvmm.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the resource properties. */ +@Fluent +public final class VirtualNetworkProperties { + /* + * Gets or sets the inventory Item ID for the resource. + */ + @JsonProperty(value = "inventoryItemId") + private String inventoryItemId; + + /* + * Unique ID of the virtual network. + */ + @JsonProperty(value = "uuid") + private String uuid; + + /* + * ARM Id of the vmmServer resource in which this resource resides. + */ + @JsonProperty(value = "vmmServerId") + private String vmmServerId; + + /* + * Name of the virtual network in vmmServer. + */ + @JsonProperty(value = "networkName", access = JsonProperty.Access.WRITE_ONLY) + private String networkName; + + /* + * Gets or sets the provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @return the inventoryItemId value. + */ + public String inventoryItemId() { + return this.inventoryItemId; + } + + /** + * Set the inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @param inventoryItemId the inventoryItemId value to set. + * @return the VirtualNetworkProperties object itself. + */ + public VirtualNetworkProperties withInventoryItemId(String inventoryItemId) { + this.inventoryItemId = inventoryItemId; + return this; + } + + /** + * Get the uuid property: Unique ID of the virtual network. + * + * @return the uuid value. + */ + public String uuid() { + return this.uuid; + } + + /** + * Set the uuid property: Unique ID of the virtual network. + * + * @param uuid the uuid value to set. + * @return the VirtualNetworkProperties object itself. + */ + public VirtualNetworkProperties withUuid(String uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @return the vmmServerId value. + */ + public String vmmServerId() { + return this.vmmServerId; + } + + /** + * Set the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @param vmmServerId the vmmServerId value to set. + * @return the VirtualNetworkProperties object itself. + */ + public VirtualNetworkProperties withVmmServerId(String vmmServerId) { + this.vmmServerId = vmmServerId; + return this; + } + + /** + * Get the networkName property: Name of the virtual network in vmmServer. + * + * @return the networkName value. + */ + public String networkName() { + return this.networkName; + } + + /** + * Get the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VmmServerInner.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VmmServerInner.java new file mode 100644 index 0000000000000..1a7055cbb9a41 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VmmServerInner.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; +import com.azure.resourcemanager.scvmm.models.VmmServerPropertiesCredentials; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The VmmServers resource definition. */ +@Fluent +public final class VmmServerInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties", required = true) + private VmmServerProperties innerProperties = new VmmServerProperties(); + + /* + * The system data. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The extended location. + */ + @JsonProperty(value = "extendedLocation", required = true) + private ExtendedLocation extendedLocation; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private VmmServerProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: The system data. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the extendedLocation property: The extended location. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extended location. + * + * @param extendedLocation the extendedLocation value to set. + * @return the VmmServerInner object itself. + */ + public VmmServerInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** {@inheritDoc} */ + @Override + public VmmServerInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public VmmServerInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the credentials property: Credentials to connect to VMMServer. + * + * @return the credentials value. + */ + public VmmServerPropertiesCredentials credentials() { + return this.innerProperties() == null ? null : this.innerProperties().credentials(); + } + + /** + * Set the credentials property: Credentials to connect to VMMServer. + * + * @param credentials the credentials value to set. + * @return the VmmServerInner object itself. + */ + public VmmServerInner withCredentials(VmmServerPropertiesCredentials credentials) { + if (this.innerProperties() == null) { + this.innerProperties = new VmmServerProperties(); + } + this.innerProperties().withCredentials(credentials); + return this; + } + + /** + * Get the fqdn property: Fqdn is the hostname/ip of the vmmServer. + * + * @return the fqdn value. + */ + public String fqdn() { + return this.innerProperties() == null ? null : this.innerProperties().fqdn(); + } + + /** + * Set the fqdn property: Fqdn is the hostname/ip of the vmmServer. + * + * @param fqdn the fqdn value to set. + * @return the VmmServerInner object itself. + */ + public VmmServerInner withFqdn(String fqdn) { + if (this.innerProperties() == null) { + this.innerProperties = new VmmServerProperties(); + } + this.innerProperties().withFqdn(fqdn); + return this; + } + + /** + * Get the port property: Port is the port on which the vmmServer is listening. + * + * @return the port value. + */ + public Integer port() { + return this.innerProperties() == null ? null : this.innerProperties().port(); + } + + /** + * Set the port property: Port is the port on which the vmmServer is listening. + * + * @param port the port value to set. + * @return the VmmServerInner object itself. + */ + public VmmServerInner withPort(Integer port) { + if (this.innerProperties() == null) { + this.innerProperties = new VmmServerProperties(); + } + this.innerProperties().withPort(port); + return this; + } + + /** + * Get the connectionStatus property: Gets or sets the connection status to the vmmServer. + * + * @return the connectionStatus value. + */ + public String connectionStatus() { + return this.innerProperties() == null ? null : this.innerProperties().connectionStatus(); + } + + /** + * Get the errorMessage property: Gets or sets any error message if connection to vmmServer is having any issue. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.innerProperties() == null ? null : this.innerProperties().errorMessage(); + } + + /** + * Get the uuid property: Unique ID of vmmServer. + * + * @return the uuid value. + */ + public String uuid() { + return this.innerProperties() == null ? null : this.innerProperties().uuid(); + } + + /** + * Get the version property: Version is the version of the vmmSever. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Get the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + public String 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property innerProperties in model VmmServerInner")); + } else { + innerProperties().validate(); + } + if (extendedLocation() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property extendedLocation in model VmmServerInner")); + } else { + extendedLocation().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VmmServerInner.class); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VmmServerProperties.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VmmServerProperties.java new file mode 100644 index 0000000000000..704610ebb9acc --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/VmmServerProperties.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.scvmm.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.scvmm.models.VmmServerPropertiesCredentials; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the resource properties. */ +@Fluent +public final class VmmServerProperties { + /* + * Credentials to connect to VMMServer. + */ + @JsonProperty(value = "credentials") + private VmmServerPropertiesCredentials credentials; + + /* + * Fqdn is the hostname/ip of the vmmServer. + */ + @JsonProperty(value = "fqdn", required = true) + private String fqdn; + + /* + * Port is the port on which the vmmServer is listening. + */ + @JsonProperty(value = "port") + private Integer port; + + /* + * Gets or sets the connection status to the vmmServer. + */ + @JsonProperty(value = "connectionStatus", access = JsonProperty.Access.WRITE_ONLY) + private String connectionStatus; + + /* + * Gets or sets any error message if connection to vmmServer is having any + * issue. + */ + @JsonProperty(value = "errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /* + * Unique ID of vmmServer. + */ + @JsonProperty(value = "uuid", access = JsonProperty.Access.WRITE_ONLY) + private String uuid; + + /* + * Version is the version of the vmmSever. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /* + * Gets or sets the provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the credentials property: Credentials to connect to VMMServer. + * + * @return the credentials value. + */ + public VmmServerPropertiesCredentials credentials() { + return this.credentials; + } + + /** + * Set the credentials property: Credentials to connect to VMMServer. + * + * @param credentials the credentials value to set. + * @return the VmmServerProperties object itself. + */ + public VmmServerProperties withCredentials(VmmServerPropertiesCredentials credentials) { + this.credentials = credentials; + return this; + } + + /** + * Get the fqdn property: Fqdn is the hostname/ip of the vmmServer. + * + * @return the fqdn value. + */ + public String fqdn() { + return this.fqdn; + } + + /** + * Set the fqdn property: Fqdn is the hostname/ip of the vmmServer. + * + * @param fqdn the fqdn value to set. + * @return the VmmServerProperties object itself. + */ + public VmmServerProperties withFqdn(String fqdn) { + this.fqdn = fqdn; + return this; + } + + /** + * Get the port property: Port is the port on which the vmmServer is listening. + * + * @return the port value. + */ + public Integer port() { + return this.port; + } + + /** + * Set the port property: Port is the port on which the vmmServer is listening. + * + * @param port the port value to set. + * @return the VmmServerProperties object itself. + */ + public VmmServerProperties withPort(Integer port) { + this.port = port; + return this; + } + + /** + * Get the connectionStatus property: Gets or sets the connection status to the vmmServer. + * + * @return the connectionStatus value. + */ + public String connectionStatus() { + return this.connectionStatus; + } + + /** + * Get the errorMessage property: Gets or sets any error message if connection to vmmServer is having any issue. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the uuid property: Unique ID of vmmServer. + * + * @return the uuid value. + */ + public String uuid() { + return this.uuid; + } + + /** + * Get the version property: Version is the version of the vmmSever. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Get the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (credentials() != null) { + credentials().validate(); + } + if (fqdn() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property fqdn in model VmmServerProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VmmServerProperties.class); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/package-info.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/models/package-info.java new file mode 100644 index 0000000000000..e29b1393b6ea8 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/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 ScvmmClient. SCVMM Client. */ +package com.azure.resourcemanager.scvmm.fluent.models; diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/package-info.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/fluent/package-info.java new file mode 100644 index 0000000000000..e998cfd26c0a8 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/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 ScvmmClient. SCVMM Client. */ +package com.azure.resourcemanager.scvmm.fluent; diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/AvailabilitySetImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/AvailabilitySetImpl.java new file mode 100644 index 0000000000000..4390fab75a5de --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/AvailabilitySetImpl.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.scvmm.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.fluent.models.AvailabilitySetInner; +import com.azure.resourcemanager.scvmm.models.AvailabilitySet; +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; +import com.azure.resourcemanager.scvmm.models.ResourcePatch; +import java.util.Collections; +import java.util.Map; + +public final class AvailabilitySetImpl implements AvailabilitySet, AvailabilitySet.Definition, AvailabilitySet.Update { + private AvailabilitySetInner innerObject; + + private final com.azure.resourcemanager.scvmm.ScvmmManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public String availabilitySetName() { + return this.innerModel().availabilitySetName(); + } + + public String vmmServerId() { + return this.innerModel().vmmServerId(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public AvailabilitySetInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.scvmm.ScvmmManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String availabilitySetName; + + private ResourcePatch updateBody; + + public AvailabilitySetImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public AvailabilitySet create() { + this.innerObject = + serviceManager + .serviceClient() + .getAvailabilitySets() + .createOrUpdate(resourceGroupName, availabilitySetName, this.innerModel(), Context.NONE); + return this; + } + + public AvailabilitySet create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAvailabilitySets() + .createOrUpdate(resourceGroupName, availabilitySetName, this.innerModel(), context); + return this; + } + + AvailabilitySetImpl(String name, com.azure.resourcemanager.scvmm.ScvmmManager serviceManager) { + this.innerObject = new AvailabilitySetInner(); + this.serviceManager = serviceManager; + this.availabilitySetName = name; + } + + public AvailabilitySetImpl update() { + this.updateBody = new ResourcePatch(); + return this; + } + + public AvailabilitySet apply() { + this.innerObject = + serviceManager + .serviceClient() + .getAvailabilitySets() + .update(resourceGroupName, availabilitySetName, updateBody, Context.NONE); + return this; + } + + public AvailabilitySet apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAvailabilitySets() + .update(resourceGroupName, availabilitySetName, updateBody, context); + return this; + } + + AvailabilitySetImpl(AvailabilitySetInner innerObject, com.azure.resourcemanager.scvmm.ScvmmManager 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.updateBody.withTags(tags); + return this; + } + } + + public AvailabilitySetImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public AvailabilitySetImpl withAvailabilitySetName(String availabilitySetName) { + this.innerModel().withAvailabilitySetName(availabilitySetName); + return this; + } + + public AvailabilitySetImpl withVmmServerId(String vmmServerId) { + this.innerModel().withVmmServerId(vmmServerId); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/AvailabilitySetsClientImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/AvailabilitySetsClientImpl.java new file mode 100644 index 0000000000000..aa2b0656b2cb4 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/AvailabilitySetsClientImpl.java @@ -0,0 +1,1611 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.scvmm.fluent.AvailabilitySetsClient; +import com.azure.resourcemanager.scvmm.fluent.models.AvailabilitySetInner; +import com.azure.resourcemanager.scvmm.models.AvailabilitySetListResult; +import com.azure.resourcemanager.scvmm.models.ResourcePatch; +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 AvailabilitySetsClient. */ +public final class AvailabilitySetsClientImpl implements AvailabilitySetsClient { + /** The proxy service used to perform REST calls. */ + private final AvailabilitySetsService service; + + /** The service client containing this operation class. */ + private final ScvmmClientImpl client; + + /** + * Initializes an instance of AvailabilitySetsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AvailabilitySetsClientImpl(ScvmmClientImpl client) { + this.service = + RestProxy.create(AvailabilitySetsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ScvmmClientAvailabilitySets to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ScvmmClientAvailabil") + private interface AvailabilitySetsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/availabilitySets/{availabilitySetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("availabilitySetName") String availabilitySetName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/availabilitySets/{availabilitySetName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("availabilitySetName") String availabilitySetName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AvailabilitySetInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/availabilitySets/{availabilitySetName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("availabilitySetName") String availabilitySetName, + @QueryParam("api-version") String apiVersion, + @QueryParam("force") Boolean force, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/availabilitySets/{availabilitySetName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("availabilitySetName") String availabilitySetName, + @BodyParam("application/json") ResourcePatch body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/availabilitySets") + @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.ScVmm/availabilitySets") + @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"}) + @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> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Implements AvailabilitySet GET method. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (availabilitySetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilitySetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + availabilitySetName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements AvailabilitySet GET method. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (availabilitySetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilitySetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + availabilitySetName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Implements AvailabilitySet GET method. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition 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(); + } + }); + } + + /** + * Implements AvailabilitySet GET method. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AvailabilitySetInner getByResourceGroup(String resourceGroupName, String availabilitySetName) { + return getByResourceGroupAsync(resourceGroupName, availabilitySetName).block(); + } + + /** + * Implements AvailabilitySet GET method. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String availabilitySetName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, availabilitySetName, context).block(); + } + + /** + * Onboards the ScVmm availability set as an Azure resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String availabilitySetName, AvailabilitySetInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (availabilitySetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilitySetName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + availabilitySetName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Onboards the ScVmm availability set as an Azure resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String availabilitySetName, AvailabilitySetInner body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (availabilitySetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilitySetName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + availabilitySetName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Onboards the ScVmm availability set as an Azure resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AvailabilitySetInner> beginCreateOrUpdateAsync( + String resourceGroupName, String availabilitySetName, AvailabilitySetInner body) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, availabilitySetName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + AvailabilitySetInner.class, + AvailabilitySetInner.class, + this.client.getContext()); + } + + /** + * Onboards the ScVmm availability set as an Azure resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AvailabilitySetInner> beginCreateOrUpdateAsync( + String resourceGroupName, String availabilitySetName, AvailabilitySetInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, availabilitySetName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AvailabilitySetInner.class, AvailabilitySetInner.class, context); + } + + /** + * Onboards the ScVmm availability set as an Azure resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AvailabilitySetInner> beginCreateOrUpdate( + String resourceGroupName, String availabilitySetName, AvailabilitySetInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, availabilitySetName, body).getSyncPoller(); + } + + /** + * Onboards the ScVmm availability set as an Azure resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AvailabilitySetInner> beginCreateOrUpdate( + String resourceGroupName, String availabilitySetName, AvailabilitySetInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, availabilitySetName, body, context).getSyncPoller(); + } + + /** + * Onboards the ScVmm availability set as an Azure resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String availabilitySetName, AvailabilitySetInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, availabilitySetName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Onboards the ScVmm availability set as an Azure resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String availabilitySetName, AvailabilitySetInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, availabilitySetName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Onboards the ScVmm availability set as an Azure resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AvailabilitySetInner createOrUpdate( + String resourceGroupName, String availabilitySetName, AvailabilitySetInner body) { + return createOrUpdateAsync(resourceGroupName, availabilitySetName, body).block(); + } + + /** + * Onboards the ScVmm availability set as an Azure resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AvailabilitySetInner createOrUpdate( + String resourceGroupName, String availabilitySetName, AvailabilitySetInner body, Context context) { + return createOrUpdateAsync(resourceGroupName, availabilitySetName, body, context).block(); + } + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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, Boolean force) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (availabilitySetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilitySetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + availabilitySetName, + this.client.getApiVersion(), + force, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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, Boolean force, 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 (availabilitySetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilitySetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + availabilitySetName, + this.client.getApiVersion(), + force, + accept, + context); + } + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String availabilitySetName, Boolean force) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, availabilitySetName, force); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String availabilitySetName, Boolean force, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, availabilitySetName, force, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String availabilitySetName, Boolean force) { + return beginDeleteAsync(resourceGroupName, availabilitySetName, force).getSyncPoller(); + } + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String availabilitySetName, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, availabilitySetName, force, context).getSyncPoller(); + } + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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, Boolean force) { + return beginDeleteAsync(resourceGroupName, availabilitySetName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) { + final Boolean force = null; + return beginDeleteAsync(resourceGroupName, availabilitySetName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, availabilitySetName, force, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 availabilitySetName, Boolean force) { + deleteAsync(resourceGroupName, availabilitySetName, force).block(); + } + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 availabilitySetName) { + final Boolean force = null; + deleteAsync(resourceGroupName, availabilitySetName, force).block(); + } + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 availabilitySetName, Boolean force, Context context) { + deleteAsync(resourceGroupName, availabilitySetName, force, context).block(); + } + + /** + * Updates the AvailabilitySets resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body AvailabilitySets patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String availabilitySetName, ResourcePatch body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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.")); + } + if (availabilitySetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilitySetName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + availabilitySetName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the AvailabilitySets resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body AvailabilitySets patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String availabilitySetName, ResourcePatch body, 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.")); + } + if (availabilitySetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter availabilitySetName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + availabilitySetName, + body, + accept, + context); + } + + /** + * Updates the AvailabilitySets resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body AvailabilitySets patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AvailabilitySetInner> beginUpdateAsync( + String resourceGroupName, String availabilitySetName, ResourcePatch body) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, availabilitySetName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + AvailabilitySetInner.class, + AvailabilitySetInner.class, + this.client.getContext()); + } + + /** + * Updates the AvailabilitySets resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body AvailabilitySets patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AvailabilitySetInner> beginUpdateAsync( + String resourceGroupName, String availabilitySetName, ResourcePatch body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, availabilitySetName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AvailabilitySetInner.class, AvailabilitySetInner.class, context); + } + + /** + * Updates the AvailabilitySets resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body AvailabilitySets patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AvailabilitySetInner> beginUpdate( + String resourceGroupName, String availabilitySetName, ResourcePatch body) { + return beginUpdateAsync(resourceGroupName, availabilitySetName, body).getSyncPoller(); + } + + /** + * Updates the AvailabilitySets resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body AvailabilitySets patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AvailabilitySetInner> beginUpdate( + String resourceGroupName, String availabilitySetName, ResourcePatch body, Context context) { + return beginUpdateAsync(resourceGroupName, availabilitySetName, body, context).getSyncPoller(); + } + + /** + * Updates the AvailabilitySets resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body AvailabilitySets patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String availabilitySetName, ResourcePatch body) { + return beginUpdateAsync(resourceGroupName, availabilitySetName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the AvailabilitySets resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body AvailabilitySets patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String availabilitySetName, ResourcePatch body, Context context) { + return beginUpdateAsync(resourceGroupName, availabilitySetName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the AvailabilitySets resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body AvailabilitySets patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AvailabilitySetInner update(String resourceGroupName, String availabilitySetName, ResourcePatch body) { + return updateAsync(resourceGroupName, availabilitySetName, body).block(); + } + + /** + * Updates the AvailabilitySets resource. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param body AvailabilitySets patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AvailabilitySetInner update( + String resourceGroupName, String availabilitySetName, ResourcePatch body, Context context) { + return updateAsync(resourceGroupName, availabilitySetName, body, context).block(); + } + + /** + * List of AvailabilitySets in 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 list of AvailabilitySets along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List of AvailabilitySets 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 ManagementException 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 AvailabilitySets along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List of AvailabilitySets in 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 list of AvailabilitySets as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List of AvailabilitySets 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 ManagementException 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 AvailabilitySets as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List of AvailabilitySets in 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 list of AvailabilitySets as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List of AvailabilitySets 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 ManagementException 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 AvailabilitySets as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * List of AvailabilitySets in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of AvailabilitySets along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List of AvailabilitySets in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of AvailabilitySets along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List of AvailabilitySets in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of AvailabilitySets as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List of AvailabilitySets in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of AvailabilitySets as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List of AvailabilitySets in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of AvailabilitySets as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List of AvailabilitySets in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of AvailabilitySets as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 list of AvailabilitySets 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 list of AvailabilitySets 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 list of AvailabilitySets 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 ManagementException 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 AvailabilitySets 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/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/AvailabilitySetsImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/AvailabilitySetsImpl.java new file mode 100644 index 0000000000000..63d4267c5eac6 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/AvailabilitySetsImpl.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.scvmm.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.scvmm.fluent.AvailabilitySetsClient; +import com.azure.resourcemanager.scvmm.fluent.models.AvailabilitySetInner; +import com.azure.resourcemanager.scvmm.models.AvailabilitySet; +import com.azure.resourcemanager.scvmm.models.AvailabilitySets; + +public final class AvailabilitySetsImpl implements AvailabilitySets { + private static final ClientLogger LOGGER = new ClientLogger(AvailabilitySetsImpl.class); + + private final AvailabilitySetsClient innerClient; + + private final com.azure.resourcemanager.scvmm.ScvmmManager serviceManager; + + public AvailabilitySetsImpl( + AvailabilitySetsClient innerClient, com.azure.resourcemanager.scvmm.ScvmmManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + 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 void delete(String resourceGroupName, String availabilitySetName, Boolean force) { + this.serviceClient().delete(resourceGroupName, availabilitySetName, force); + } + + public void delete(String resourceGroupName, String availabilitySetName) { + this.serviceClient().delete(resourceGroupName, availabilitySetName); + } + + public void delete(String resourceGroupName, String availabilitySetName, Boolean force, Context context) { + this.serviceClient().delete(resourceGroupName, availabilitySetName, force, context); + } + + 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 list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new AvailabilitySetImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new AvailabilitySetImpl(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))); + } + Boolean localForce = null; + this.delete(resourceGroupName, availabilitySetName, localForce, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Boolean force, 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))); + } + this.delete(resourceGroupName, availabilitySetName, force, context); + } + + private AvailabilitySetsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.scvmm.ScvmmManager manager() { + return this.serviceManager; + } + + public AvailabilitySetImpl define(String name) { + return new AvailabilitySetImpl(name, this.manager()); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/CloudImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/CloudImpl.java new file mode 100644 index 0000000000000..17e8e011ff66d --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/CloudImpl.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.scvmm.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.fluent.models.CloudInner; +import com.azure.resourcemanager.scvmm.models.Cloud; +import com.azure.resourcemanager.scvmm.models.CloudCapacity; +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; +import com.azure.resourcemanager.scvmm.models.ResourcePatch; +import com.azure.resourcemanager.scvmm.models.StorageQoSPolicy; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class CloudImpl implements Cloud, Cloud.Definition, Cloud.Update { + private CloudInner innerObject; + + private final com.azure.resourcemanager.scvmm.ScvmmManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public String inventoryItemId() { + return this.innerModel().inventoryItemId(); + } + + public String uuid() { + return this.innerModel().uuid(); + } + + public String vmmServerId() { + return this.innerModel().vmmServerId(); + } + + public String cloudName() { + return this.innerModel().cloudName(); + } + + public CloudCapacity cloudCapacity() { + return this.innerModel().cloudCapacity(); + } + + public List storageQoSPolicies() { + List inner = this.innerModel().storageQoSPolicies(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public CloudInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.scvmm.ScvmmManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String cloudName; + + private ResourcePatch updateBody; + + public CloudImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Cloud create() { + this.innerObject = + serviceManager + .serviceClient() + .getClouds() + .createOrUpdate(resourceGroupName, cloudName, this.innerModel(), Context.NONE); + return this; + } + + public Cloud create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getClouds() + .createOrUpdate(resourceGroupName, cloudName, this.innerModel(), context); + return this; + } + + CloudImpl(String name, com.azure.resourcemanager.scvmm.ScvmmManager serviceManager) { + this.innerObject = new CloudInner(); + this.serviceManager = serviceManager; + this.cloudName = name; + } + + public CloudImpl update() { + this.updateBody = new ResourcePatch(); + return this; + } + + public Cloud apply() { + this.innerObject = + serviceManager.serviceClient().getClouds().update(resourceGroupName, cloudName, updateBody, Context.NONE); + return this; + } + + public Cloud apply(Context context) { + this.innerObject = + serviceManager.serviceClient().getClouds().update(resourceGroupName, cloudName, updateBody, context); + return this; + } + + CloudImpl(CloudInner innerObject, com.azure.resourcemanager.scvmm.ScvmmManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.cloudName = Utils.getValueFromIdByName(innerObject.id(), "clouds"); + } + + public Cloud refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getClouds() + .getByResourceGroupWithResponse(resourceGroupName, cloudName, Context.NONE) + .getValue(); + return this; + } + + public Cloud refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getClouds() + .getByResourceGroupWithResponse(resourceGroupName, cloudName, context) + .getValue(); + return this; + } + + public CloudImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public CloudImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public CloudImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public CloudImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public CloudImpl withInventoryItemId(String inventoryItemId) { + this.innerModel().withInventoryItemId(inventoryItemId); + return this; + } + + public CloudImpl withUuid(String uuid) { + this.innerModel().withUuid(uuid); + return this; + } + + public CloudImpl withVmmServerId(String vmmServerId) { + this.innerModel().withVmmServerId(vmmServerId); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/CloudsClientImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/CloudsClientImpl.java new file mode 100644 index 0000000000000..60776d333cfe9 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/CloudsClientImpl.java @@ -0,0 +1,1573 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.scvmm.fluent.CloudsClient; +import com.azure.resourcemanager.scvmm.fluent.models.CloudInner; +import com.azure.resourcemanager.scvmm.models.CloudListResult; +import com.azure.resourcemanager.scvmm.models.ResourcePatch; +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 CloudsClient. */ +public final class CloudsClientImpl implements CloudsClient { + /** The proxy service used to perform REST calls. */ + private final CloudsService service; + + /** The service client containing this operation class. */ + private final ScvmmClientImpl client; + + /** + * Initializes an instance of CloudsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CloudsClientImpl(ScvmmClientImpl client) { + this.service = RestProxy.create(CloudsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ScvmmClientClouds to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ScvmmClientClouds") + private interface CloudsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds" + + "/{cloudName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudName") String cloudName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds" + + "/{cloudName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudName") String cloudName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CloudInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds" + + "/{cloudName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("cloudName") String cloudName, + @QueryParam("api-version") String apiVersion, + @QueryParam("force") Boolean force, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds" + + "/{cloudName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("cloudName") String cloudName, + @BodyParam("application/json") ResourcePatch body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds") + @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.ScVmm/clouds") + @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"}) + @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> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Implements Cloud GET method. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String cloudName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (cloudName == null) { + return Mono.error(new IllegalArgumentException("Parameter cloudName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements Cloud GET method. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String cloudName, 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 (cloudName == null) { + return Mono.error(new IllegalArgumentException("Parameter cloudName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Implements Cloud GET method. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String cloudName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, cloudName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Implements Cloud GET method. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudInner getByResourceGroup(String resourceGroupName, String cloudName) { + return getByResourceGroupAsync(resourceGroupName, cloudName).block(); + } + + /** + * Implements Cloud GET method. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String cloudName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, cloudName, context).block(); + } + + /** + * Onboards the ScVmm fabric cloud as an Azure cloud resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String cloudName, CloudInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudName == null) { + return Mono.error(new IllegalArgumentException("Parameter cloudName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Onboards the ScVmm fabric cloud as an Azure cloud resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String cloudName, CloudInner body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (cloudName == null) { + return Mono.error(new IllegalArgumentException("Parameter cloudName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Onboards the ScVmm fabric cloud as an Azure cloud resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CloudInner> beginCreateOrUpdateAsync( + String resourceGroupName, String cloudName, CloudInner body) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, cloudName, body); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), CloudInner.class, CloudInner.class, this.client.getContext()); + } + + /** + * Onboards the ScVmm fabric cloud as an Azure cloud resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CloudInner> beginCreateOrUpdateAsync( + String resourceGroupName, String cloudName, CloudInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, cloudName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), CloudInner.class, CloudInner.class, context); + } + + /** + * Onboards the ScVmm fabric cloud as an Azure cloud resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudInner> beginCreateOrUpdate( + String resourceGroupName, String cloudName, CloudInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, cloudName, body).getSyncPoller(); + } + + /** + * Onboards the ScVmm fabric cloud as an Azure cloud resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudInner> beginCreateOrUpdate( + String resourceGroupName, String cloudName, CloudInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, cloudName, body, context).getSyncPoller(); + } + + /** + * Onboards the ScVmm fabric cloud as an Azure cloud resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String cloudName, CloudInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, cloudName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Onboards the ScVmm fabric cloud as an Azure cloud resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String cloudName, CloudInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, cloudName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Onboards the ScVmm fabric cloud as an Azure cloud resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudInner createOrUpdate(String resourceGroupName, String cloudName, CloudInner body) { + return createOrUpdateAsync(resourceGroupName, cloudName, body).block(); + } + + /** + * Onboards the ScVmm fabric cloud as an Azure cloud resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudInner createOrUpdate(String resourceGroupName, String cloudName, CloudInner body, Context context) { + return createOrUpdateAsync(resourceGroupName, cloudName, body, context).block(); + } + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 cloudName, Boolean force) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (cloudName == null) { + return Mono.error(new IllegalArgumentException("Parameter cloudName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudName, + this.client.getApiVersion(), + force, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 cloudName, Boolean force, 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 (cloudName == null) { + return Mono.error(new IllegalArgumentException("Parameter cloudName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + cloudName, + this.client.getApiVersion(), + force, + accept, + context); + } + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String cloudName, Boolean force) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, cloudName, force); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String cloudName, Boolean force, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, cloudName, force, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String cloudName, Boolean force) { + return beginDeleteAsync(resourceGroupName, cloudName, force).getSyncPoller(); + } + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String cloudName, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, cloudName, force, context).getSyncPoller(); + } + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 cloudName, Boolean force) { + return beginDeleteAsync(resourceGroupName, cloudName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 cloudName) { + final Boolean force = null; + return beginDeleteAsync(resourceGroupName, cloudName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 cloudName, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, cloudName, force, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 cloudName, Boolean force) { + deleteAsync(resourceGroupName, cloudName, force).block(); + } + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 cloudName) { + final Boolean force = null; + deleteAsync(resourceGroupName, cloudName, force).block(); + } + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 cloudName, Boolean force, Context context) { + deleteAsync(resourceGroupName, cloudName, force, context).block(); + } + + /** + * Updates the Clouds resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Clouds patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String cloudName, ResourcePatch body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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.")); + } + if (cloudName == null) { + return Mono.error(new IllegalArgumentException("Parameter cloudName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cloudName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the Clouds resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Clouds patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String cloudName, ResourcePatch body, 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.")); + } + if (cloudName == null) { + return Mono.error(new IllegalArgumentException("Parameter cloudName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + cloudName, + body, + accept, + context); + } + + /** + * Updates the Clouds resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Clouds patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CloudInner> beginUpdateAsync( + String resourceGroupName, String cloudName, ResourcePatch body) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, cloudName, body); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), CloudInner.class, CloudInner.class, this.client.getContext()); + } + + /** + * Updates the Clouds resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Clouds patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CloudInner> beginUpdateAsync( + String resourceGroupName, String cloudName, ResourcePatch body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = updateWithResponseAsync(resourceGroupName, cloudName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), CloudInner.class, CloudInner.class, context); + } + + /** + * Updates the Clouds resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Clouds patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudInner> beginUpdate( + String resourceGroupName, String cloudName, ResourcePatch body) { + return beginUpdateAsync(resourceGroupName, cloudName, body).getSyncPoller(); + } + + /** + * Updates the Clouds resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Clouds patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CloudInner> beginUpdate( + String resourceGroupName, String cloudName, ResourcePatch body, Context context) { + return beginUpdateAsync(resourceGroupName, cloudName, body, context).getSyncPoller(); + } + + /** + * Updates the Clouds resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Clouds patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String cloudName, ResourcePatch body) { + return beginUpdateAsync(resourceGroupName, cloudName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the Clouds resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Clouds patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String cloudName, ResourcePatch body, Context context) { + return beginUpdateAsync(resourceGroupName, cloudName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the Clouds resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Clouds patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudInner update(String resourceGroupName, String cloudName, ResourcePatch body) { + return updateAsync(resourceGroupName, cloudName, body).block(); + } + + /** + * Updates the Clouds resource. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param body Clouds patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CloudInner update(String resourceGroupName, String cloudName, ResourcePatch body, Context context) { + return updateAsync(resourceGroupName, cloudName, body, context).block(); + } + + /** + * List of Clouds in 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 list of Clouds along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List of Clouds 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 ManagementException 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 Clouds along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List of Clouds in 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 list of Clouds as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List of Clouds 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 ManagementException 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 Clouds as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List of Clouds in 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 list of Clouds as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List of Clouds 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 ManagementException 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 Clouds as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * List of Clouds in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Clouds along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List of Clouds in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Clouds along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List of Clouds in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Clouds as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List of Clouds in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Clouds as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List of Clouds in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Clouds as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List of Clouds in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Clouds as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 list of Clouds 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 list of Clouds 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 list of Clouds 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 ManagementException 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 Clouds 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/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/CloudsImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/CloudsImpl.java new file mode 100644 index 0000000000000..b4ca6f79e4a46 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/CloudsImpl.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.scvmm.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.scvmm.fluent.CloudsClient; +import com.azure.resourcemanager.scvmm.fluent.models.CloudInner; +import com.azure.resourcemanager.scvmm.models.Cloud; +import com.azure.resourcemanager.scvmm.models.Clouds; + +public final class CloudsImpl implements Clouds { + private static final ClientLogger LOGGER = new ClientLogger(CloudsImpl.class); + + private final CloudsClient innerClient; + + private final com.azure.resourcemanager.scvmm.ScvmmManager serviceManager; + + public CloudsImpl(CloudsClient innerClient, com.azure.resourcemanager.scvmm.ScvmmManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Cloud getByResourceGroup(String resourceGroupName, String cloudName) { + CloudInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, cloudName); + if (inner != null) { + return new CloudImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String cloudName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, cloudName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CloudImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String cloudName, Boolean force) { + this.serviceClient().delete(resourceGroupName, cloudName, force); + } + + public void delete(String resourceGroupName, String cloudName) { + this.serviceClient().delete(resourceGroupName, cloudName); + } + + public void delete(String resourceGroupName, String cloudName, Boolean force, Context context) { + this.serviceClient().delete(resourceGroupName, cloudName, force, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new CloudImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new CloudImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new CloudImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new CloudImpl(inner1, this.manager())); + } + + public Cloud 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 cloudName = Utils.getValueFromIdByName(id, "clouds"); + if (cloudName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'clouds'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, cloudName, 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 cloudName = Utils.getValueFromIdByName(id, "clouds"); + if (cloudName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'clouds'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, cloudName, 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 cloudName = Utils.getValueFromIdByName(id, "clouds"); + if (cloudName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'clouds'.", id))); + } + Boolean localForce = null; + this.delete(resourceGroupName, cloudName, localForce, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Boolean force, 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 cloudName = Utils.getValueFromIdByName(id, "clouds"); + if (cloudName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'clouds'.", id))); + } + this.delete(resourceGroupName, cloudName, force, context); + } + + private CloudsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.scvmm.ScvmmManager manager() { + return this.serviceManager; + } + + public CloudImpl define(String name) { + return new CloudImpl(name, this.manager()); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/InventoryItemImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/InventoryItemImpl.java new file mode 100644 index 0000000000000..7157463d7f076 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/InventoryItemImpl.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.fluent.models.InventoryItemInner; +import com.azure.resourcemanager.scvmm.models.InventoryItem; + +public final class InventoryItemImpl implements InventoryItem, InventoryItem.Definition { + private InventoryItemInner innerObject; + + private final com.azure.resourcemanager.scvmm.ScvmmManager serviceManager; + + InventoryItemImpl(InventoryItemInner innerObject, com.azure.resourcemanager.scvmm.ScvmmManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String managedResourceId() { + return this.innerModel().managedResourceId(); + } + + public String uuid() { + return this.innerModel().uuid(); + } + + public String inventoryItemName() { + return this.innerModel().inventoryItemName(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public InventoryItemInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.scvmm.ScvmmManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String vmmServerName; + + private String inventoryItemName; + + public InventoryItemImpl withExistingVmmServer(String resourceGroupName, String vmmServerName) { + this.resourceGroupName = resourceGroupName; + this.vmmServerName = vmmServerName; + return this; + } + + public InventoryItem create() { + this.innerObject = + serviceManager + .serviceClient() + .getInventoryItems() + .createWithResponse( + resourceGroupName, vmmServerName, inventoryItemName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public InventoryItem create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getInventoryItems() + .createWithResponse(resourceGroupName, vmmServerName, inventoryItemName, this.innerModel(), context) + .getValue(); + return this; + } + + InventoryItemImpl(String name, com.azure.resourcemanager.scvmm.ScvmmManager serviceManager) { + this.innerObject = new InventoryItemInner(); + this.serviceManager = serviceManager; + this.inventoryItemName = name; + } + + public InventoryItem refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getInventoryItems() + .getWithResponse(resourceGroupName, vmmServerName, inventoryItemName, Context.NONE) + .getValue(); + return this; + } + + public InventoryItem refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getInventoryItems() + .getWithResponse(resourceGroupName, vmmServerName, inventoryItemName, context) + .getValue(); + return this; + } + + public InventoryItemImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/InventoryItemsClientImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/InventoryItemsClientImpl.java new file mode 100644 index 0000000000000..136791f05e827 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/InventoryItemsClientImpl.java @@ -0,0 +1,921 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.scvmm.fluent.InventoryItemsClient; +import com.azure.resourcemanager.scvmm.fluent.models.InventoryItemInner; +import com.azure.resourcemanager.scvmm.models.InventoryItemsList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in InventoryItemsClient. */ +public final class InventoryItemsClientImpl implements InventoryItemsClient { + /** The proxy service used to perform REST calls. */ + private final InventoryItemsService service; + + /** The service client containing this operation class. */ + private final ScvmmClientImpl client; + + /** + * Initializes an instance of InventoryItemsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + InventoryItemsClientImpl(ScvmmClientImpl client) { + this.service = + RestProxy.create(InventoryItemsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ScvmmClientInventoryItems to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ScvmmClientInventory") + private interface InventoryItemsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers" + + "/{vmmServerName}/inventoryItems/{inventoryItemName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmmServerName") String vmmServerName, + @PathParam("inventoryItemName") String inventoryItemName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") InventoryItemInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers" + + "/{vmmServerName}/inventoryItems/{inventoryItemName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmmServerName") String vmmServerName, + @PathParam("inventoryItemName") String inventoryItemName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers" + + "/{vmmServerName}/inventoryItems/{inventoryItemName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmmServerName") String vmmServerName, + @PathParam("inventoryItemName") String inventoryItemName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers" + + "/{vmmServerName}/inventoryItems") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByVmmServer( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmmServerName") String vmmServerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByVmmServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create Or Update InventoryItem. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the inventory item along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, String vmmServerName, String inventoryItemName, InventoryItemInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmmServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmmServerName is required and cannot be null.")); + } + if (inventoryItemName == null) { + return Mono + .error(new IllegalArgumentException("Parameter inventoryItemName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vmmServerName, + inventoryItemName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create Or Update InventoryItem. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the inventory item along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String vmmServerName, + String inventoryItemName, + InventoryItemInner body, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmmServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmmServerName is required and cannot be null.")); + } + if (inventoryItemName == null) { + return Mono + .error(new IllegalArgumentException("Parameter inventoryItemName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vmmServerName, + inventoryItemName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Create Or Update InventoryItem. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the inventory item on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String vmmServerName, String inventoryItemName, InventoryItemInner body) { + return createWithResponseAsync(resourceGroupName, vmmServerName, inventoryItemName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create Or Update InventoryItem. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the inventory item on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String vmmServerName, String inventoryItemName) { + final InventoryItemInner body = null; + return createWithResponseAsync(resourceGroupName, vmmServerName, inventoryItemName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create Or Update InventoryItem. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the inventory item. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InventoryItemInner create(String resourceGroupName, String vmmServerName, String inventoryItemName) { + final InventoryItemInner body = null; + return createAsync(resourceGroupName, vmmServerName, inventoryItemName, body).block(); + } + + /** + * Create Or Update InventoryItem. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the inventory item along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String vmmServerName, + String inventoryItemName, + InventoryItemInner body, + Context context) { + return createWithResponseAsync(resourceGroupName, vmmServerName, inventoryItemName, body, context).block(); + } + + /** + * Shows an inventory item. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the inventory item along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String vmmServerName, String inventoryItemName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (vmmServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmmServerName is required and cannot be null.")); + } + if (inventoryItemName == null) { + return Mono + .error(new IllegalArgumentException("Parameter inventoryItemName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vmmServerName, + inventoryItemName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Shows an inventory item. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the inventory item along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String vmmServerName, String inventoryItemName, 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 (vmmServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmmServerName is required and cannot be null.")); + } + if (inventoryItemName == null) { + return Mono + .error(new IllegalArgumentException("Parameter inventoryItemName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vmmServerName, + inventoryItemName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Shows an inventory item. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the inventory item on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String vmmServerName, String inventoryItemName) { + return getWithResponseAsync(resourceGroupName, vmmServerName, inventoryItemName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Shows an inventory item. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the inventory item. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InventoryItemInner get(String resourceGroupName, String vmmServerName, String inventoryItemName) { + return getAsync(resourceGroupName, vmmServerName, inventoryItemName).block(); + } + + /** + * Shows an inventory item. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the inventory item along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String vmmServerName, String inventoryItemName, Context context) { + return getWithResponseAsync(resourceGroupName, vmmServerName, inventoryItemName, context).block(); + } + + /** + * Deletes an inventoryItem. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 vmmServerName, String inventoryItemName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (vmmServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmmServerName is required and cannot be null.")); + } + if (inventoryItemName == null) { + return Mono + .error(new IllegalArgumentException("Parameter inventoryItemName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vmmServerName, + inventoryItemName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an inventoryItem. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 vmmServerName, String inventoryItemName, 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 (vmmServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmmServerName is required and cannot be null.")); + } + if (inventoryItemName == null) { + return Mono + .error(new IllegalArgumentException("Parameter inventoryItemName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vmmServerName, + inventoryItemName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes an inventoryItem. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 vmmServerName, String inventoryItemName) { + return deleteWithResponseAsync(resourceGroupName, vmmServerName, inventoryItemName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes an inventoryItem. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 vmmServerName, String inventoryItemName) { + deleteAsync(resourceGroupName, vmmServerName, inventoryItemName).block(); + } + + /** + * Deletes an inventoryItem. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 vmmServerName, String inventoryItemName, Context context) { + return deleteWithResponseAsync(resourceGroupName, vmmServerName, inventoryItemName, context).block(); + } + + /** + * Returns the list of inventoryItems in the given VMMServer. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 InventoryItems along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVmmServerSinglePageAsync( + String resourceGroupName, String vmmServerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (vmmServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmmServerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByVmmServer( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vmmServerName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns the list of inventoryItems in the given VMMServer. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 InventoryItems along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVmmServerSinglePageAsync( + String resourceGroupName, String vmmServerName, 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 (vmmServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmmServerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByVmmServer( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vmmServerName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns the list of inventoryItems in the given VMMServer. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 InventoryItems as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByVmmServerAsync(String resourceGroupName, String vmmServerName) { + return new PagedFlux<>( + () -> listByVmmServerSinglePageAsync(resourceGroupName, vmmServerName), + nextLink -> listByVmmServerNextSinglePageAsync(nextLink)); + } + + /** + * Returns the list of inventoryItems in the given VMMServer. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 InventoryItems as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByVmmServerAsync( + String resourceGroupName, String vmmServerName, Context context) { + return new PagedFlux<>( + () -> listByVmmServerSinglePageAsync(resourceGroupName, vmmServerName, context), + nextLink -> listByVmmServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns the list of inventoryItems in the given VMMServer. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 InventoryItems as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByVmmServer(String resourceGroupName, String vmmServerName) { + return new PagedIterable<>(listByVmmServerAsync(resourceGroupName, vmmServerName)); + } + + /** + * Returns the list of inventoryItems in the given VMMServer. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 InventoryItems as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByVmmServer( + String resourceGroupName, String vmmServerName, Context context) { + return new PagedIterable<>(listByVmmServerAsync(resourceGroupName, vmmServerName, 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 list of InventoryItems along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVmmServerNextSinglePageAsync(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.listByVmmServerNext(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 list of InventoryItems along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVmmServerNextSinglePageAsync( + 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 + .listByVmmServerNext(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/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/InventoryItemsImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/InventoryItemsImpl.java new file mode 100644 index 0000000000000..a07f975b9cc1f --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/InventoryItemsImpl.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.scvmm.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.scvmm.fluent.InventoryItemsClient; +import com.azure.resourcemanager.scvmm.fluent.models.InventoryItemInner; +import com.azure.resourcemanager.scvmm.models.InventoryItem; +import com.azure.resourcemanager.scvmm.models.InventoryItems; + +public final class InventoryItemsImpl implements InventoryItems { + private static final ClientLogger LOGGER = new ClientLogger(InventoryItemsImpl.class); + + private final InventoryItemsClient innerClient; + + private final com.azure.resourcemanager.scvmm.ScvmmManager serviceManager; + + public InventoryItemsImpl( + InventoryItemsClient innerClient, com.azure.resourcemanager.scvmm.ScvmmManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public InventoryItem get(String resourceGroupName, String vmmServerName, String inventoryItemName) { + InventoryItemInner inner = this.serviceClient().get(resourceGroupName, vmmServerName, inventoryItemName); + if (inner != null) { + return new InventoryItemImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String vmmServerName, String inventoryItemName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, vmmServerName, inventoryItemName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new InventoryItemImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String vmmServerName, String inventoryItemName) { + this.serviceClient().delete(resourceGroupName, vmmServerName, inventoryItemName); + } + + public Response deleteWithResponse( + String resourceGroupName, String vmmServerName, String inventoryItemName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, vmmServerName, inventoryItemName, context); + } + + public PagedIterable listByVmmServer(String resourceGroupName, String vmmServerName) { + PagedIterable inner = + this.serviceClient().listByVmmServer(resourceGroupName, vmmServerName); + return Utils.mapPage(inner, inner1 -> new InventoryItemImpl(inner1, this.manager())); + } + + public PagedIterable listByVmmServer( + String resourceGroupName, String vmmServerName, Context context) { + PagedIterable inner = + this.serviceClient().listByVmmServer(resourceGroupName, vmmServerName, context); + return Utils.mapPage(inner, inner1 -> new InventoryItemImpl(inner1, this.manager())); + } + + public InventoryItem 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 vmmServerName = Utils.getValueFromIdByName(id, "vmmServers"); + if (vmmServerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vmmServers'.", id))); + } + String inventoryItemName = Utils.getValueFromIdByName(id, "inventoryItems"); + if (inventoryItemName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'inventoryItems'.", id))); + } + return this.getWithResponse(resourceGroupName, vmmServerName, inventoryItemName, 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 vmmServerName = Utils.getValueFromIdByName(id, "vmmServers"); + if (vmmServerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vmmServers'.", id))); + } + String inventoryItemName = Utils.getValueFromIdByName(id, "inventoryItems"); + if (inventoryItemName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'inventoryItems'.", id))); + } + return this.getWithResponse(resourceGroupName, vmmServerName, inventoryItemName, 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 vmmServerName = Utils.getValueFromIdByName(id, "vmmServers"); + if (vmmServerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vmmServers'.", id))); + } + String inventoryItemName = Utils.getValueFromIdByName(id, "inventoryItems"); + if (inventoryItemName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'inventoryItems'.", id))); + } + this.deleteWithResponse(resourceGroupName, vmmServerName, inventoryItemName, 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 vmmServerName = Utils.getValueFromIdByName(id, "vmmServers"); + if (vmmServerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vmmServers'.", id))); + } + String inventoryItemName = Utils.getValueFromIdByName(id, "inventoryItems"); + if (inventoryItemName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'inventoryItems'.", id))); + } + return this.deleteWithResponse(resourceGroupName, vmmServerName, inventoryItemName, context); + } + + private InventoryItemsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.scvmm.ScvmmManager manager() { + return this.serviceManager; + } + + public InventoryItemImpl define(String name) { + return new InventoryItemImpl(name, this.manager()); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/OperationsClientImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..6c2d34b068b27 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/OperationsClientImpl.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.scvmm.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.scvmm.fluent.OperationsClient; +import com.azure.resourcemanager.scvmm.fluent.models.ResourceProviderOperationInner; +import com.azure.resourcemanager.scvmm.models.ResourceProviderOperationList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final ScvmmClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ScvmmClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ScvmmClientOperations to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ScvmmClientOperation") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ScVmm/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Returns list of all operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list 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 accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns list of all operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list 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 accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Returns list of all operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list operations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Returns list of all operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list operations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns list of all operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Returns list of all operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 results of the request to list operations 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 results of the request to list operations 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/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/OperationsImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..1157b91a72f8c --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/OperationsImpl.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.scvmm.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.scvmm.fluent.OperationsClient; +import com.azure.resourcemanager.scvmm.fluent.models.ResourceProviderOperationInner; +import com.azure.resourcemanager.scvmm.models.Operations; +import com.azure.resourcemanager.scvmm.models.ResourceProviderOperation; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.scvmm.ScvmmManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, com.azure.resourcemanager.scvmm.ScvmmManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ResourceProviderOperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ResourceProviderOperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.scvmm.ScvmmManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/ResourceProviderOperationImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/ResourceProviderOperationImpl.java new file mode 100644 index 0000000000000..c0e013e3c6614 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/ResourceProviderOperationImpl.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.scvmm.implementation; + +import com.azure.resourcemanager.scvmm.fluent.models.ResourceProviderOperationInner; +import com.azure.resourcemanager.scvmm.models.ResourceProviderOperation; +import com.azure.resourcemanager.scvmm.models.ResourceProviderOperationDisplay; + +public final class ResourceProviderOperationImpl implements ResourceProviderOperation { + private ResourceProviderOperationInner innerObject; + + private final com.azure.resourcemanager.scvmm.ScvmmManager serviceManager; + + ResourceProviderOperationImpl( + ResourceProviderOperationInner innerObject, com.azure.resourcemanager.scvmm.ScvmmManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String isDataAction() { + return this.innerModel().isDataAction(); + } + + public String name() { + return this.innerModel().name(); + } + + public ResourceProviderOperationDisplay display() { + return this.innerModel().display(); + } + + public ResourceProviderOperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.scvmm.ScvmmManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/ScvmmClientBuilder.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/ScvmmClientBuilder.java new file mode 100644 index 0000000000000..a4f2395c8a754 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/ScvmmClientBuilder.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.scvmm.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the ScvmmClientImpl type. */ +@ServiceClientBuilder(serviceClients = {ScvmmClientImpl.class}) +public final class ScvmmClientBuilder { + /* + * The Azure subscription ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + */ + private String subscriptionId; + + /** + * Sets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @param subscriptionId the subscriptionId value. + * @return the ScvmmClientBuilder. + */ + public ScvmmClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the ScvmmClientBuilder. + */ + public ScvmmClientBuilder 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 ScvmmClientBuilder. + */ + public ScvmmClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the ScvmmClientBuilder. + */ + public ScvmmClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the ScvmmClientBuilder. + */ + public ScvmmClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the ScvmmClientBuilder. + */ + public ScvmmClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ScvmmClientImpl with the provided parameters. + * + * @return an instance of ScvmmClientImpl. + */ + public ScvmmClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (pipeline == null) { + this.pipeline = new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + ScvmmClientImpl client = + new ScvmmClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/ScvmmClientImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/ScvmmClientImpl.java new file mode 100644 index 0000000000000..417328600ef57 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/ScvmmClientImpl.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.scvmm.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.scvmm.fluent.AvailabilitySetsClient; +import com.azure.resourcemanager.scvmm.fluent.CloudsClient; +import com.azure.resourcemanager.scvmm.fluent.InventoryItemsClient; +import com.azure.resourcemanager.scvmm.fluent.OperationsClient; +import com.azure.resourcemanager.scvmm.fluent.ScvmmClient; +import com.azure.resourcemanager.scvmm.fluent.VirtualMachineTemplatesClient; +import com.azure.resourcemanager.scvmm.fluent.VirtualMachinesClient; +import com.azure.resourcemanager.scvmm.fluent.VirtualNetworksClient; +import com.azure.resourcemanager.scvmm.fluent.VmmServersClient; +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 ScvmmClientImpl type. */ +@ServiceClient(builder = ScvmmClientBuilder.class) +public final class ScvmmClientImpl implements ScvmmClient { + /** The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). */ + private final String subscriptionId; + + /** + * Gets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The VmmServersClient object to access its operations. */ + private final VmmServersClient vmmServers; + + /** + * Gets the VmmServersClient object to access its operations. + * + * @return the VmmServersClient object. + */ + public VmmServersClient getVmmServers() { + return this.vmmServers; + } + + /** 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 CloudsClient object to access its operations. */ + private final CloudsClient clouds; + + /** + * Gets the CloudsClient object to access its operations. + * + * @return the CloudsClient object. + */ + public CloudsClient getClouds() { + return this.clouds; + } + + /** The VirtualNetworksClient object to access its operations. */ + private final VirtualNetworksClient virtualNetworks; + + /** + * Gets the VirtualNetworksClient object to access its operations. + * + * @return the VirtualNetworksClient object. + */ + public VirtualNetworksClient getVirtualNetworks() { + return this.virtualNetworks; + } + + /** 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 VirtualMachineTemplatesClient object to access its operations. */ + private final VirtualMachineTemplatesClient virtualMachineTemplates; + + /** + * Gets the VirtualMachineTemplatesClient object to access its operations. + * + * @return the VirtualMachineTemplatesClient object. + */ + public VirtualMachineTemplatesClient getVirtualMachineTemplates() { + return this.virtualMachineTemplates; + } + + /** 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 InventoryItemsClient object to access its operations. */ + private final InventoryItemsClient inventoryItems; + + /** + * Gets the InventoryItemsClient object to access its operations. + * + * @return the InventoryItemsClient object. + */ + public InventoryItemsClient getInventoryItems() { + return this.inventoryItems; + } + + /** + * Initializes an instance of ScvmmClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The Azure subscription ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param endpoint server parameter. + */ + ScvmmClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2020-06-05-preview"; + this.vmmServers = new VmmServersClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.clouds = new CloudsClientImpl(this); + this.virtualNetworks = new VirtualNetworksClientImpl(this); + this.virtualMachines = new VirtualMachinesClientImpl(this); + this.virtualMachineTemplates = new VirtualMachineTemplatesClientImpl(this); + this.availabilitySets = new AvailabilitySetsClientImpl(this); + this.inventoryItems = new InventoryItemsClientImpl(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)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ScvmmClientImpl.class); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/Utils.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/Utils.java new file mode 100644 index 0000000000000..75b2c07623be9 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/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.scvmm.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/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualMachineImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualMachineImpl.java new file mode 100644 index 0000000000000..c12cf684e0a54 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualMachineImpl.java @@ -0,0 +1,409 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.fluent.models.VirtualMachineInner; +import com.azure.resourcemanager.scvmm.models.AvailabilitySetListItem; +import com.azure.resourcemanager.scvmm.models.Checkpoint; +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; +import com.azure.resourcemanager.scvmm.models.HardwareProfile; +import com.azure.resourcemanager.scvmm.models.NetworkProfile; +import com.azure.resourcemanager.scvmm.models.OsProfile; +import com.azure.resourcemanager.scvmm.models.StopVirtualMachineOptions; +import com.azure.resourcemanager.scvmm.models.StorageProfile; +import com.azure.resourcemanager.scvmm.models.VirtualMachine; +import com.azure.resourcemanager.scvmm.models.VirtualMachineCreateCheckpoint; +import com.azure.resourcemanager.scvmm.models.VirtualMachineDeleteCheckpoint; +import com.azure.resourcemanager.scvmm.models.VirtualMachineRestoreCheckpoint; +import com.azure.resourcemanager.scvmm.models.VirtualMachineUpdate; +import com.azure.resourcemanager.scvmm.models.VirtualMachineUpdateProperties; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class VirtualMachineImpl implements VirtualMachine, VirtualMachine.Definition, VirtualMachine.Update { + private VirtualMachineInner innerObject; + + private final com.azure.resourcemanager.scvmm.ScvmmManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public String inventoryItemId() { + return this.innerModel().inventoryItemId(); + } + + public String vmmServerId() { + return this.innerModel().vmmServerId(); + } + + public String cloudId() { + return this.innerModel().cloudId(); + } + + public String templateId() { + return this.innerModel().templateId(); + } + + public String checkpointType() { + return this.innerModel().checkpointType(); + } + + public List checkpoints() { + List inner = this.innerModel().checkpoints(); + 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 OsProfile osProfile() { + return this.innerModel().osProfile(); + } + + public HardwareProfile hardwareProfile() { + return this.innerModel().hardwareProfile(); + } + + public NetworkProfile networkProfile() { + return this.innerModel().networkProfile(); + } + + public StorageProfile storageProfile() { + return this.innerModel().storageProfile(); + } + + public String vmName() { + return this.innerModel().vmName(); + } + + public String uuid() { + return this.innerModel().uuid(); + } + + public Integer generation() { + return this.innerModel().generation(); + } + + public String powerState() { + return this.innerModel().powerState(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public VirtualMachineInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.scvmm.ScvmmManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String virtualMachineName; + + private VirtualMachineUpdate updateBody; + + public VirtualMachineImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public VirtualMachine create() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachines() + .createOrUpdate(resourceGroupName, virtualMachineName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualMachine create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachines() + .createOrUpdate(resourceGroupName, virtualMachineName, this.innerModel(), context); + return this; + } + + VirtualMachineImpl(String name, com.azure.resourcemanager.scvmm.ScvmmManager serviceManager) { + this.innerObject = new VirtualMachineInner(); + this.serviceManager = serviceManager; + this.virtualMachineName = name; + } + + public VirtualMachineImpl update() { + this.updateBody = new VirtualMachineUpdate(); + return this; + } + + public VirtualMachine apply() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachines() + .update(resourceGroupName, virtualMachineName, updateBody, Context.NONE); + return this; + } + + public VirtualMachine apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachines() + .update(resourceGroupName, virtualMachineName, updateBody, context); + return this; + } + + VirtualMachineImpl(VirtualMachineInner innerObject, com.azure.resourcemanager.scvmm.ScvmmManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.virtualMachineName = Utils.getValueFromIdByName(innerObject.id(), "virtualMachines"); + } + + public VirtualMachine refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachines() + .getByResourceGroupWithResponse(resourceGroupName, virtualMachineName, Context.NONE) + .getValue(); + return this; + } + + public VirtualMachine refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachines() + .getByResourceGroupWithResponse(resourceGroupName, virtualMachineName, context) + .getValue(); + return this; + } + + public void stop(StopVirtualMachineOptions body) { + serviceManager.virtualMachines().stop(resourceGroupName, virtualMachineName, body); + } + + public void stop() { + serviceManager.virtualMachines().stop(resourceGroupName, virtualMachineName); + } + + public void stop(StopVirtualMachineOptions body, Context context) { + serviceManager.virtualMachines().stop(resourceGroupName, virtualMachineName, body, context); + } + + public void start() { + serviceManager.virtualMachines().start(resourceGroupName, virtualMachineName); + } + + public void start(Context context) { + serviceManager.virtualMachines().start(resourceGroupName, virtualMachineName, context); + } + + public void restart() { + serviceManager.virtualMachines().restart(resourceGroupName, virtualMachineName); + } + + public void restart(Context context) { + serviceManager.virtualMachines().restart(resourceGroupName, virtualMachineName, context); + } + + public void createCheckpoint(VirtualMachineCreateCheckpoint body) { + serviceManager.virtualMachines().createCheckpoint(resourceGroupName, virtualMachineName, body); + } + + public void createCheckpoint() { + serviceManager.virtualMachines().createCheckpoint(resourceGroupName, virtualMachineName); + } + + public void createCheckpoint(VirtualMachineCreateCheckpoint body, Context context) { + serviceManager.virtualMachines().createCheckpoint(resourceGroupName, virtualMachineName, body, context); + } + + public void deleteCheckpoint(VirtualMachineDeleteCheckpoint body) { + serviceManager.virtualMachines().deleteCheckpoint(resourceGroupName, virtualMachineName, body); + } + + public void deleteCheckpoint() { + serviceManager.virtualMachines().deleteCheckpoint(resourceGroupName, virtualMachineName); + } + + public void deleteCheckpoint(VirtualMachineDeleteCheckpoint body, Context context) { + serviceManager.virtualMachines().deleteCheckpoint(resourceGroupName, virtualMachineName, body, context); + } + + public void restoreCheckpoint(VirtualMachineRestoreCheckpoint body) { + serviceManager.virtualMachines().restoreCheckpoint(resourceGroupName, virtualMachineName, body); + } + + public void restoreCheckpoint() { + serviceManager.virtualMachines().restoreCheckpoint(resourceGroupName, virtualMachineName); + } + + public void restoreCheckpoint(VirtualMachineRestoreCheckpoint body, Context context) { + serviceManager.virtualMachines().restoreCheckpoint(resourceGroupName, virtualMachineName, body, 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 withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public VirtualMachineImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public VirtualMachineImpl withInventoryItemId(String inventoryItemId) { + this.innerModel().withInventoryItemId(inventoryItemId); + return this; + } + + public VirtualMachineImpl withVmmServerId(String vmmServerId) { + this.innerModel().withVmmServerId(vmmServerId); + return this; + } + + public VirtualMachineImpl withCloudId(String cloudId) { + this.innerModel().withCloudId(cloudId); + return this; + } + + public VirtualMachineImpl withTemplateId(String templateId) { + this.innerModel().withTemplateId(templateId); + return this; + } + + public VirtualMachineImpl withCheckpointType(String checkpointType) { + this.innerModel().withCheckpointType(checkpointType); + return this; + } + + public VirtualMachineImpl withCheckpoints(List checkpoints) { + this.innerModel().withCheckpoints(checkpoints); + return this; + } + + public VirtualMachineImpl withAvailabilitySets(List availabilitySets) { + this.innerModel().withAvailabilitySets(availabilitySets); + return this; + } + + public VirtualMachineImpl withOsProfile(OsProfile osProfile) { + this.innerModel().withOsProfile(osProfile); + return this; + } + + public VirtualMachineImpl withHardwareProfile(HardwareProfile hardwareProfile) { + this.innerModel().withHardwareProfile(hardwareProfile); + return this; + } + + public VirtualMachineImpl withNetworkProfile(NetworkProfile networkProfile) { + this.innerModel().withNetworkProfile(networkProfile); + return this; + } + + public VirtualMachineImpl withStorageProfile(StorageProfile storageProfile) { + this.innerModel().withStorageProfile(storageProfile); + return this; + } + + public VirtualMachineImpl withVmName(String vmName) { + this.innerModel().withVmName(vmName); + return this; + } + + public VirtualMachineImpl withUuid(String uuid) { + this.innerModel().withUuid(uuid); + return this; + } + + public VirtualMachineImpl withGeneration(Integer generation) { + this.innerModel().withGeneration(generation); + return this; + } + + public VirtualMachineImpl withProperties(VirtualMachineUpdateProperties properties) { + this.updateBody.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualMachineTemplateImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualMachineTemplateImpl.java new file mode 100644 index 0000000000000..24907810be13f --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualMachineTemplateImpl.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.fluent.models.VirtualMachineTemplateInner; +import com.azure.resourcemanager.scvmm.models.DynamicMemoryEnabled; +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; +import com.azure.resourcemanager.scvmm.models.IsCustomizable; +import com.azure.resourcemanager.scvmm.models.LimitCpuForMigration; +import com.azure.resourcemanager.scvmm.models.NetworkInterfaces; +import com.azure.resourcemanager.scvmm.models.OsType; +import com.azure.resourcemanager.scvmm.models.ResourcePatch; +import com.azure.resourcemanager.scvmm.models.VirtualDisk; +import com.azure.resourcemanager.scvmm.models.VirtualMachineTemplate; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class VirtualMachineTemplateImpl + implements VirtualMachineTemplate, VirtualMachineTemplate.Definition, VirtualMachineTemplate.Update { + private VirtualMachineTemplateInner innerObject; + + private final com.azure.resourcemanager.scvmm.ScvmmManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public String inventoryItemId() { + return this.innerModel().inventoryItemId(); + } + + public String uuid() { + return this.innerModel().uuid(); + } + + public String vmmServerId() { + return this.innerModel().vmmServerId(); + } + + public OsType osType() { + return this.innerModel().osType(); + } + + public String osName() { + return this.innerModel().osName(); + } + + public String computerName() { + return this.innerModel().computerName(); + } + + public Integer memoryMB() { + return this.innerModel().memoryMB(); + } + + public Integer cpuCount() { + return this.innerModel().cpuCount(); + } + + public LimitCpuForMigration limitCpuForMigration() { + return this.innerModel().limitCpuForMigration(); + } + + public DynamicMemoryEnabled dynamicMemoryEnabled() { + return this.innerModel().dynamicMemoryEnabled(); + } + + public IsCustomizable isCustomizable() { + return this.innerModel().isCustomizable(); + } + + public Integer dynamicMemoryMaxMB() { + return this.innerModel().dynamicMemoryMaxMB(); + } + + public Integer dynamicMemoryMinMB() { + return this.innerModel().dynamicMemoryMinMB(); + } + + public String isHighlyAvailable() { + return this.innerModel().isHighlyAvailable(); + } + + public Integer generation() { + return this.innerModel().generation(); + } + + public List networkInterfaces() { + List inner = this.innerModel().networkInterfaces(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List disks() { + List inner = this.innerModel().disks(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public VirtualMachineTemplateInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.scvmm.ScvmmManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String virtualMachineTemplateName; + + private ResourcePatch updateBody; + + public VirtualMachineTemplateImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public VirtualMachineTemplate create() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineTemplates() + .createOrUpdate(resourceGroupName, virtualMachineTemplateName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualMachineTemplate create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineTemplates() + .createOrUpdate(resourceGroupName, virtualMachineTemplateName, this.innerModel(), context); + return this; + } + + VirtualMachineTemplateImpl(String name, com.azure.resourcemanager.scvmm.ScvmmManager serviceManager) { + this.innerObject = new VirtualMachineTemplateInner(); + this.serviceManager = serviceManager; + this.virtualMachineTemplateName = name; + } + + public VirtualMachineTemplateImpl update() { + this.updateBody = new ResourcePatch(); + return this; + } + + public VirtualMachineTemplate apply() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineTemplates() + .update(resourceGroupName, virtualMachineTemplateName, updateBody, Context.NONE); + return this; + } + + public VirtualMachineTemplate apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineTemplates() + .update(resourceGroupName, virtualMachineTemplateName, updateBody, context); + return this; + } + + VirtualMachineTemplateImpl( + VirtualMachineTemplateInner innerObject, com.azure.resourcemanager.scvmm.ScvmmManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.virtualMachineTemplateName = Utils.getValueFromIdByName(innerObject.id(), "virtualMachineTemplates"); + } + + public VirtualMachineTemplate refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineTemplates() + .getByResourceGroupWithResponse(resourceGroupName, virtualMachineTemplateName, Context.NONE) + .getValue(); + return this; + } + + public VirtualMachineTemplate refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineTemplates() + .getByResourceGroupWithResponse(resourceGroupName, virtualMachineTemplateName, context) + .getValue(); + return this; + } + + public VirtualMachineTemplateImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public VirtualMachineTemplateImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public VirtualMachineTemplateImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public VirtualMachineTemplateImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public VirtualMachineTemplateImpl withInventoryItemId(String inventoryItemId) { + this.innerModel().withInventoryItemId(inventoryItemId); + return this; + } + + public VirtualMachineTemplateImpl withUuid(String uuid) { + this.innerModel().withUuid(uuid); + return this; + } + + public VirtualMachineTemplateImpl withVmmServerId(String vmmServerId) { + this.innerModel().withVmmServerId(vmmServerId); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualMachineTemplatesClientImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualMachineTemplatesClientImpl.java new file mode 100644 index 0000000000000..e444c19a89501 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualMachineTemplatesClientImpl.java @@ -0,0 +1,1664 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.scvmm.fluent.VirtualMachineTemplatesClient; +import com.azure.resourcemanager.scvmm.fluent.models.VirtualMachineTemplateInner; +import com.azure.resourcemanager.scvmm.models.ResourcePatch; +import com.azure.resourcemanager.scvmm.models.VirtualMachineTemplateListResult; +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 VirtualMachineTemplatesClient. */ +public final class VirtualMachineTemplatesClientImpl implements VirtualMachineTemplatesClient { + /** The proxy service used to perform REST calls. */ + private final VirtualMachineTemplatesService service; + + /** The service client containing this operation class. */ + private final ScvmmClientImpl client; + + /** + * Initializes an instance of VirtualMachineTemplatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachineTemplatesClientImpl(ScvmmClientImpl client) { + this.service = + RestProxy + .create(VirtualMachineTemplatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ScvmmClientVirtualMachineTemplates to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ScvmmClientVirtualMa") + private interface VirtualMachineTemplatesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/virtualMachineTemplates/{virtualMachineTemplateName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualMachineTemplateName") String virtualMachineTemplateName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/virtualMachineTemplates/{virtualMachineTemplateName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualMachineTemplateName") String virtualMachineTemplateName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") VirtualMachineTemplateInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/virtualMachineTemplates/{virtualMachineTemplateName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualMachineTemplateName") String virtualMachineTemplateName, + @QueryParam("api-version") String apiVersion, + @QueryParam("force") Boolean force, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/virtualMachineTemplates/{virtualMachineTemplateName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("virtualMachineTemplateName") String virtualMachineTemplateName, + @BodyParam("application/json") ResourcePatch body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/virtualMachineTemplates") + @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.ScVmm/virtualMachineTemplates") + @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"}) + @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> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Implements VirtualMachineTemplate GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String virtualMachineTemplateName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (virtualMachineTemplateName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter virtualMachineTemplateName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineTemplateName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements VirtualMachineTemplate GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String virtualMachineTemplateName, 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 (virtualMachineTemplateName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter virtualMachineTemplateName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineTemplateName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Implements VirtualMachineTemplate GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String virtualMachineTemplateName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, virtualMachineTemplateName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Implements VirtualMachineTemplate GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineTemplateInner getByResourceGroup(String resourceGroupName, String virtualMachineTemplateName) { + return getByResourceGroupAsync(resourceGroupName, virtualMachineTemplateName).block(); + } + + /** + * Implements VirtualMachineTemplate GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualMachineTemplateName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, virtualMachineTemplateName, context).block(); + } + + /** + * Onboards the ScVmm VM Template as an Azure VM Template resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String virtualMachineTemplateName, VirtualMachineTemplateInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualMachineTemplateName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter virtualMachineTemplateName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineTemplateName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Onboards the ScVmm VM Template as an Azure VM Template resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String virtualMachineTemplateName, + VirtualMachineTemplateInner body, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualMachineTemplateName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter virtualMachineTemplateName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineTemplateName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Onboards the ScVmm VM Template as an Azure VM Template resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineTemplateInner> beginCreateOrUpdateAsync( + String resourceGroupName, String virtualMachineTemplateName, VirtualMachineTemplateInner body) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, virtualMachineTemplateName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineTemplateInner.class, + VirtualMachineTemplateInner.class, + this.client.getContext()); + } + + /** + * Onboards the ScVmm VM Template as an Azure VM Template resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineTemplateInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String virtualMachineTemplateName, + VirtualMachineTemplateInner body, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, virtualMachineTemplateName, body, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineTemplateInner.class, + VirtualMachineTemplateInner.class, + context); + } + + /** + * Onboards the ScVmm VM Template as an Azure VM Template resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineTemplateInner> beginCreateOrUpdate( + String resourceGroupName, String virtualMachineTemplateName, VirtualMachineTemplateInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, virtualMachineTemplateName, body).getSyncPoller(); + } + + /** + * Onboards the ScVmm VM Template as an Azure VM Template resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineTemplateInner> beginCreateOrUpdate( + String resourceGroupName, + String virtualMachineTemplateName, + VirtualMachineTemplateInner body, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, virtualMachineTemplateName, body, context).getSyncPoller(); + } + + /** + * Onboards the ScVmm VM Template as an Azure VM Template resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String virtualMachineTemplateName, VirtualMachineTemplateInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, virtualMachineTemplateName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Onboards the ScVmm VM Template as an Azure VM Template resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String virtualMachineTemplateName, + VirtualMachineTemplateInner body, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, virtualMachineTemplateName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Onboards the ScVmm VM Template as an Azure VM Template resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineTemplateInner createOrUpdate( + String resourceGroupName, String virtualMachineTemplateName, VirtualMachineTemplateInner body) { + return createOrUpdateAsync(resourceGroupName, virtualMachineTemplateName, body).block(); + } + + /** + * Onboards the ScVmm VM Template as an Azure VM Template resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineTemplateInner createOrUpdate( + String resourceGroupName, + String virtualMachineTemplateName, + VirtualMachineTemplateInner body, + Context context) { + return createOrUpdateAsync(resourceGroupName, virtualMachineTemplateName, body, context).block(); + } + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 virtualMachineTemplateName, Boolean force) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (virtualMachineTemplateName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter virtualMachineTemplateName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineTemplateName, + this.client.getApiVersion(), + force, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 virtualMachineTemplateName, Boolean force, 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 (virtualMachineTemplateName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter virtualMachineTemplateName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineTemplateName, + this.client.getApiVersion(), + force, + accept, + context); + } + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String virtualMachineTemplateName, Boolean force) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, virtualMachineTemplateName, force); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String virtualMachineTemplateName, Boolean force, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, virtualMachineTemplateName, force, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String virtualMachineTemplateName, Boolean force) { + return beginDeleteAsync(resourceGroupName, virtualMachineTemplateName, force).getSyncPoller(); + } + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String virtualMachineTemplateName, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, virtualMachineTemplateName, force, context).getSyncPoller(); + } + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 virtualMachineTemplateName, Boolean force) { + return beginDeleteAsync(resourceGroupName, virtualMachineTemplateName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 virtualMachineTemplateName) { + final Boolean force = null; + return beginDeleteAsync(resourceGroupName, virtualMachineTemplateName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 virtualMachineTemplateName, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, virtualMachineTemplateName, force, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 virtualMachineTemplateName, Boolean force) { + deleteAsync(resourceGroupName, virtualMachineTemplateName, force).block(); + } + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 virtualMachineTemplateName) { + final Boolean force = null; + deleteAsync(resourceGroupName, virtualMachineTemplateName, force).block(); + } + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 virtualMachineTemplateName, Boolean force, Context context) { + deleteAsync(resourceGroupName, virtualMachineTemplateName, force, context).block(); + } + + /** + * Updates the VirtualMachineTemplate resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body VirtualMachineTemplates patch details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String virtualMachineTemplateName, ResourcePatch body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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.")); + } + if (virtualMachineTemplateName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter virtualMachineTemplateName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + virtualMachineTemplateName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the VirtualMachineTemplate resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body VirtualMachineTemplates patch details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String virtualMachineTemplateName, ResourcePatch body, 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.")); + } + if (virtualMachineTemplateName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter virtualMachineTemplateName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + virtualMachineTemplateName, + body, + accept, + context); + } + + /** + * Updates the VirtualMachineTemplate resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body VirtualMachineTemplates patch details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineTemplateInner> beginUpdateAsync( + String resourceGroupName, String virtualMachineTemplateName, ResourcePatch body) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, virtualMachineTemplateName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineTemplateInner.class, + VirtualMachineTemplateInner.class, + this.client.getContext()); + } + + /** + * Updates the VirtualMachineTemplate resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body VirtualMachineTemplates patch details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineTemplateInner> beginUpdateAsync( + String resourceGroupName, String virtualMachineTemplateName, ResourcePatch body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, virtualMachineTemplateName, body, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineTemplateInner.class, + VirtualMachineTemplateInner.class, + context); + } + + /** + * Updates the VirtualMachineTemplate resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body VirtualMachineTemplates patch details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineTemplateInner> beginUpdate( + String resourceGroupName, String virtualMachineTemplateName, ResourcePatch body) { + return beginUpdateAsync(resourceGroupName, virtualMachineTemplateName, body).getSyncPoller(); + } + + /** + * Updates the VirtualMachineTemplate resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body VirtualMachineTemplates patch details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineTemplateInner> beginUpdate( + String resourceGroupName, String virtualMachineTemplateName, ResourcePatch body, Context context) { + return beginUpdateAsync(resourceGroupName, virtualMachineTemplateName, body, context).getSyncPoller(); + } + + /** + * Updates the VirtualMachineTemplate resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body VirtualMachineTemplates patch details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String virtualMachineTemplateName, ResourcePatch body) { + return beginUpdateAsync(resourceGroupName, virtualMachineTemplateName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the VirtualMachineTemplate resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body VirtualMachineTemplates patch details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String virtualMachineTemplateName, ResourcePatch body, Context context) { + return beginUpdateAsync(resourceGroupName, virtualMachineTemplateName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the VirtualMachineTemplate resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body VirtualMachineTemplates patch details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineTemplateInner update( + String resourceGroupName, String virtualMachineTemplateName, ResourcePatch body) { + return updateAsync(resourceGroupName, virtualMachineTemplateName, body).block(); + } + + /** + * Updates the VirtualMachineTemplate resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param body VirtualMachineTemplates patch details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineTemplateInner update( + String resourceGroupName, String virtualMachineTemplateName, ResourcePatch body, Context context) { + return updateAsync(resourceGroupName, virtualMachineTemplateName, body, context).block(); + } + + /** + * List of VirtualMachineTemplates in 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 list of VirtualMachineTemplates along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List of VirtualMachineTemplates 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 ManagementException 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 VirtualMachineTemplates along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List of VirtualMachineTemplates in 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 list of VirtualMachineTemplates as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List of VirtualMachineTemplates 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 ManagementException 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 VirtualMachineTemplates as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List of VirtualMachineTemplates in 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 list of VirtualMachineTemplates as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List of VirtualMachineTemplates 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 ManagementException 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 VirtualMachineTemplates as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * List of VirtualMachineTemplates in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualMachineTemplates along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List of VirtualMachineTemplates in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualMachineTemplates along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List of VirtualMachineTemplates in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualMachineTemplates as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List of VirtualMachineTemplates in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualMachineTemplates as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List of VirtualMachineTemplates in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualMachineTemplates as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List of VirtualMachineTemplates in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualMachineTemplates as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 list of VirtualMachineTemplates 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 list of VirtualMachineTemplates 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 list of VirtualMachineTemplates 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 ManagementException 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 VirtualMachineTemplates 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/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualMachineTemplatesImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualMachineTemplatesImpl.java new file mode 100644 index 0000000000000..3bf7cf2382869 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualMachineTemplatesImpl.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.scvmm.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.scvmm.fluent.VirtualMachineTemplatesClient; +import com.azure.resourcemanager.scvmm.fluent.models.VirtualMachineTemplateInner; +import com.azure.resourcemanager.scvmm.models.VirtualMachineTemplate; +import com.azure.resourcemanager.scvmm.models.VirtualMachineTemplates; + +public final class VirtualMachineTemplatesImpl implements VirtualMachineTemplates { + private static final ClientLogger LOGGER = new ClientLogger(VirtualMachineTemplatesImpl.class); + + private final VirtualMachineTemplatesClient innerClient; + + private final com.azure.resourcemanager.scvmm.ScvmmManager serviceManager; + + public VirtualMachineTemplatesImpl( + VirtualMachineTemplatesClient innerClient, com.azure.resourcemanager.scvmm.ScvmmManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public VirtualMachineTemplate getByResourceGroup(String resourceGroupName, String virtualMachineTemplateName) { + VirtualMachineTemplateInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, virtualMachineTemplateName); + if (inner != null) { + return new VirtualMachineTemplateImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualMachineTemplateName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, virtualMachineTemplateName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualMachineTemplateImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String virtualMachineTemplateName, Boolean force) { + this.serviceClient().delete(resourceGroupName, virtualMachineTemplateName, force); + } + + public void delete(String resourceGroupName, String virtualMachineTemplateName) { + this.serviceClient().delete(resourceGroupName, virtualMachineTemplateName); + } + + public void delete(String resourceGroupName, String virtualMachineTemplateName, Boolean force, Context context) { + this.serviceClient().delete(resourceGroupName, virtualMachineTemplateName, force, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new VirtualMachineTemplateImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new VirtualMachineTemplateImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new VirtualMachineTemplateImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new VirtualMachineTemplateImpl(inner1, this.manager())); + } + + public VirtualMachineTemplate 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 virtualMachineTemplateName = Utils.getValueFromIdByName(id, "virtualMachineTemplates"); + if (virtualMachineTemplateName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualMachineTemplates'.", + id))); + } + return this + .getByResourceGroupWithResponse(resourceGroupName, virtualMachineTemplateName, 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 virtualMachineTemplateName = Utils.getValueFromIdByName(id, "virtualMachineTemplates"); + if (virtualMachineTemplateName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualMachineTemplates'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, virtualMachineTemplateName, 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 virtualMachineTemplateName = Utils.getValueFromIdByName(id, "virtualMachineTemplates"); + if (virtualMachineTemplateName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualMachineTemplates'.", + id))); + } + Boolean localForce = null; + this.delete(resourceGroupName, virtualMachineTemplateName, localForce, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Boolean force, 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 virtualMachineTemplateName = Utils.getValueFromIdByName(id, "virtualMachineTemplates"); + if (virtualMachineTemplateName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualMachineTemplates'.", + id))); + } + this.delete(resourceGroupName, virtualMachineTemplateName, force, context); + } + + private VirtualMachineTemplatesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.scvmm.ScvmmManager manager() { + return this.serviceManager; + } + + public VirtualMachineTemplateImpl define(String name) { + return new VirtualMachineTemplateImpl(name, this.manager()); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualMachinesClientImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualMachinesClientImpl.java new file mode 100644 index 0000000000000..c94d428993eb7 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualMachinesClientImpl.java @@ -0,0 +1,3353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.scvmm.fluent.VirtualMachinesClient; +import com.azure.resourcemanager.scvmm.fluent.models.VirtualMachineInner; +import com.azure.resourcemanager.scvmm.models.StopVirtualMachineOptions; +import com.azure.resourcemanager.scvmm.models.VirtualMachineCreateCheckpoint; +import com.azure.resourcemanager.scvmm.models.VirtualMachineDeleteCheckpoint; +import com.azure.resourcemanager.scvmm.models.VirtualMachineListResult; +import com.azure.resourcemanager.scvmm.models.VirtualMachineRestoreCheckpoint; +import com.azure.resourcemanager.scvmm.models.VirtualMachineUpdate; +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 { + /** The proxy service used to perform REST calls. */ + private final VirtualMachinesService service; + + /** The service client containing this operation class. */ + private final ScvmmClientImpl client; + + /** + * Initializes an instance of VirtualMachinesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachinesClientImpl(ScvmmClientImpl client) { + this.service = + RestProxy.create(VirtualMachinesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ScvmmClientVirtualMachines to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ScvmmClientVirtualMa") + private interface VirtualMachinesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/virtualMachines/{virtualMachineName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualMachineName") String virtualMachineName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/virtualMachines/{virtualMachineName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualMachineName") String virtualMachineName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") VirtualMachineInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/virtualMachines/{virtualMachineName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualMachineName") String virtualMachineName, + @QueryParam("api-version") String apiVersion, + @QueryParam("retain") Boolean retain, + @QueryParam("force") Boolean force, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/virtualMachines/{virtualMachineName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("virtualMachineName") String virtualMachineName, + @BodyParam("application/json") VirtualMachineUpdate body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/virtualMachines/{virtualMachineName}/stop") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> stop( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("virtualMachineName") String virtualMachineName, + @BodyParam("application/json") StopVirtualMachineOptions body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/virtualMachines/{virtualMachineName}/start") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> start( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("virtualMachineName") String virtualMachineName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/virtualMachines/{virtualMachineName}/restart") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> restart( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("virtualMachineName") String virtualMachineName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/virtualMachines/{virtualMachineName}/createCheckpoint") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createCheckpoint( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("virtualMachineName") String virtualMachineName, + @BodyParam("application/json") VirtualMachineCreateCheckpoint body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/virtualMachines/{virtualMachineName}/deleteCheckpoint") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteCheckpoint( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("virtualMachineName") String virtualMachineName, + @BodyParam("application/json") VirtualMachineDeleteCheckpoint body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/virtualMachines/{virtualMachineName}/restoreCheckpoint") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> restoreCheckpoint( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("virtualMachineName") String virtualMachineName, + @BodyParam("application/json") VirtualMachineRestoreCheckpoint body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/virtualMachines") + @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.ScVmm/virtualMachines") + @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"}) + @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> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Implements VirtualMachine GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String virtualMachineName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements VirtualMachine GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String virtualMachineName, 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 (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Implements VirtualMachine GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String virtualMachineName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, virtualMachineName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Implements VirtualMachine GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInner getByResourceGroup(String resourceGroupName, String virtualMachineName) { + return getByResourceGroupAsync(resourceGroupName, virtualMachineName).block(); + } + + /** + * Implements VirtualMachine GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualMachineName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, virtualMachineName, context).block(); + } + + /** + * Creates Or Updates virtual machines deployed on scvmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates Or Updates virtual machines deployed on scvmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Creates Or Updates virtual machines deployed on scvmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineInner> beginCreateOrUpdateAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, virtualMachineName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineInner.class, + VirtualMachineInner.class, + this.client.getContext()); + } + + /** + * Creates Or Updates virtual machines deployed on scvmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineInner> beginCreateOrUpdateAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, virtualMachineName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), VirtualMachineInner.class, VirtualMachineInner.class, context); + } + + /** + * Creates Or Updates virtual machines deployed on scvmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineInner> beginCreateOrUpdate( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, virtualMachineName, body).getSyncPoller(); + } + + /** + * Creates Or Updates virtual machines deployed on scvmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineInner> beginCreateOrUpdate( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, virtualMachineName, body, context).getSyncPoller(); + } + + /** + * Creates Or Updates virtual machines deployed on scvmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, virtualMachineName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates Or Updates virtual machines deployed on scvmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, virtualMachineName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates Or Updates virtual machines deployed on scvmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInner createOrUpdate( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body) { + return createOrUpdateAsync(resourceGroupName, virtualMachineName, body).block(); + } + + /** + * Creates Or Updates virtual machines deployed on scvmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInner createOrUpdate( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body, Context context) { + return createOrUpdateAsync(resourceGroupName, virtualMachineName, body, context).block(); + } + + /** + * Deletes a VirtualMachine deployed on ScVmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param retain Whether to just disable the VM from azure and retain the VM in the VMM. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 virtualMachineName, Boolean retain, Boolean force) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + this.client.getApiVersion(), + retain, + force, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a VirtualMachine deployed on ScVmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param retain Whether to just disable the VM from azure and retain the VM in the VMM. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 virtualMachineName, Boolean retain, Boolean force, 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 (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + this.client.getApiVersion(), + retain, + force, + accept, + context); + } + + /** + * Deletes a VirtualMachine deployed on ScVmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param retain Whether to just disable the VM from azure and retain the VM in the VMM. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String virtualMachineName, Boolean retain, Boolean force) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, virtualMachineName, retain, force); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a VirtualMachine deployed on ScVmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param retain Whether to just disable the VM from azure and retain the VM in the VMM. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String virtualMachineName, Boolean retain, Boolean force, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, virtualMachineName, retain, force, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a VirtualMachine deployed on ScVmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param retain Whether to just disable the VM from azure and retain the VM in the VMM. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String virtualMachineName, Boolean retain, Boolean force) { + return beginDeleteAsync(resourceGroupName, virtualMachineName, retain, force).getSyncPoller(); + } + + /** + * Deletes a VirtualMachine deployed on ScVmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param retain Whether to just disable the VM from azure and retain the VM in the VMM. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String virtualMachineName, Boolean retain, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, virtualMachineName, retain, force, context).getSyncPoller(); + } + + /** + * Deletes a VirtualMachine deployed on ScVmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param retain Whether to just disable the VM from azure and retain the VM in the VMM. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 virtualMachineName, Boolean retain, Boolean force) { + return beginDeleteAsync(resourceGroupName, virtualMachineName, retain, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a VirtualMachine deployed on ScVmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 virtualMachineName) { + final Boolean retain = null; + final Boolean force = null; + return beginDeleteAsync(resourceGroupName, virtualMachineName, retain, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a VirtualMachine deployed on ScVmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param retain Whether to just disable the VM from azure and retain the VM in the VMM. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 virtualMachineName, Boolean retain, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, virtualMachineName, retain, force, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a VirtualMachine deployed on ScVmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param retain Whether to just disable the VM from azure and retain the VM in the VMM. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 virtualMachineName, Boolean retain, Boolean force) { + deleteAsync(resourceGroupName, virtualMachineName, retain, force).block(); + } + + /** + * Deletes a VirtualMachine deployed on ScVmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 virtualMachineName) { + final Boolean retain = null; + final Boolean force = null; + deleteAsync(resourceGroupName, virtualMachineName, retain, force).block(); + } + + /** + * Deletes a VirtualMachine deployed on ScVmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param retain Whether to just disable the VM from azure and retain the VM in the VMM. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 virtualMachineName, Boolean retain, Boolean force, Context context) { + deleteAsync(resourceGroupName, virtualMachineName, retain, force, context).block(); + } + + /** + * Updates the VirtualMachines resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body VirtualMachines patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineUpdate body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + virtualMachineName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the VirtualMachines resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body VirtualMachines patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineUpdate body, 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.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + virtualMachineName, + body, + accept, + context); + } + + /** + * Updates the VirtualMachines resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body VirtualMachines patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineInner> beginUpdateAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineUpdate body) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, virtualMachineName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineInner.class, + VirtualMachineInner.class, + this.client.getContext()); + } + + /** + * Updates the VirtualMachines resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body VirtualMachines patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineInner> beginUpdateAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineUpdate body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, virtualMachineName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), VirtualMachineInner.class, VirtualMachineInner.class, context); + } + + /** + * Updates the VirtualMachines resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body VirtualMachines patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineInner> beginUpdate( + String resourceGroupName, String virtualMachineName, VirtualMachineUpdate body) { + return beginUpdateAsync(resourceGroupName, virtualMachineName, body).getSyncPoller(); + } + + /** + * Updates the VirtualMachines resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body VirtualMachines patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineInner> beginUpdate( + String resourceGroupName, String virtualMachineName, VirtualMachineUpdate body, Context context) { + return beginUpdateAsync(resourceGroupName, virtualMachineName, body, context).getSyncPoller(); + } + + /** + * Updates the VirtualMachines resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body VirtualMachines patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineUpdate body) { + return beginUpdateAsync(resourceGroupName, virtualMachineName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the VirtualMachines resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body VirtualMachines patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineUpdate body, Context context) { + return beginUpdateAsync(resourceGroupName, virtualMachineName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the VirtualMachines resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body VirtualMachines patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInner update(String resourceGroupName, String virtualMachineName, VirtualMachineUpdate body) { + return updateAsync(resourceGroupName, virtualMachineName, body).block(); + } + + /** + * Updates the VirtualMachines resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body VirtualMachines patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInner update( + String resourceGroupName, String virtualMachineName, VirtualMachineUpdate body, Context context) { + return updateAsync(resourceGroupName, virtualMachineName, body, context).block(); + } + + /** + * Stop virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine stop action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> stopWithResponseAsync( + String resourceGroupName, String virtualMachineName, StopVirtualMachineOptions body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .stop( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + virtualMachineName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Stop virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine stop action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> stopWithResponseAsync( + String resourceGroupName, String virtualMachineName, StopVirtualMachineOptions body, 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.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .stop( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + virtualMachineName, + body, + accept, + context); + } + + /** + * Stop virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine stop action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStopAsync( + String resourceGroupName, String virtualMachineName, StopVirtualMachineOptions body) { + Mono>> mono = stopWithResponseAsync(resourceGroupName, virtualMachineName, body); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Stop virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine stop action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStopAsync( + String resourceGroupName, String virtualMachineName, StopVirtualMachineOptions body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + stopWithResponseAsync(resourceGroupName, virtualMachineName, body, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Stop virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine stop action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStop( + String resourceGroupName, String virtualMachineName, StopVirtualMachineOptions body) { + return beginStopAsync(resourceGroupName, virtualMachineName, body).getSyncPoller(); + } + + /** + * Stop virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine stop action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStop( + String resourceGroupName, String virtualMachineName, StopVirtualMachineOptions body, Context context) { + return beginStopAsync(resourceGroupName, virtualMachineName, body, context).getSyncPoller(); + } + + /** + * Stop virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine stop action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopAsync(String resourceGroupName, String virtualMachineName, StopVirtualMachineOptions body) { + return beginStopAsync(resourceGroupName, virtualMachineName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Stop virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopAsync(String resourceGroupName, String virtualMachineName) { + final StopVirtualMachineOptions body = null; + return beginStopAsync(resourceGroupName, virtualMachineName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Stop virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine stop action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopAsync( + String resourceGroupName, String virtualMachineName, StopVirtualMachineOptions body, Context context) { + return beginStopAsync(resourceGroupName, virtualMachineName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Stop virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine stop action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void stop(String resourceGroupName, String virtualMachineName, StopVirtualMachineOptions body) { + stopAsync(resourceGroupName, virtualMachineName, body).block(); + } + + /** + * Stop virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void stop(String resourceGroupName, String virtualMachineName) { + final StopVirtualMachineOptions body = null; + stopAsync(resourceGroupName, virtualMachineName, body).block(); + } + + /** + * Stop virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine stop action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void stop( + String resourceGroupName, String virtualMachineName, StopVirtualMachineOptions body, Context context) { + stopAsync(resourceGroupName, virtualMachineName, body, context).block(); + } + + /** + * Start virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 virtualMachineName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .start( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + virtualMachineName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Start virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 virtualMachineName, 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.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .start( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + virtualMachineName, + accept, + context); + } + + /** + * Start virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartAsync(String resourceGroupName, String virtualMachineName) { + Mono>> mono = startWithResponseAsync(resourceGroupName, virtualMachineName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Start virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartAsync( + String resourceGroupName, String virtualMachineName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = startWithResponseAsync(resourceGroupName, virtualMachineName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Start virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart(String resourceGroupName, String virtualMachineName) { + return beginStartAsync(resourceGroupName, virtualMachineName).getSyncPoller(); + } + + /** + * Start virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart( + String resourceGroupName, String virtualMachineName, Context context) { + return beginStartAsync(resourceGroupName, virtualMachineName, context).getSyncPoller(); + } + + /** + * Start virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 virtualMachineName) { + return beginStartAsync(resourceGroupName, virtualMachineName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Start virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 virtualMachineName, Context context) { + return beginStartAsync(resourceGroupName, virtualMachineName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Start virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void start(String resourceGroupName, String virtualMachineName) { + startAsync(resourceGroupName, virtualMachineName).block(); + } + + /** + * Start virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void start(String resourceGroupName, String virtualMachineName, Context context) { + startAsync(resourceGroupName, virtualMachineName, context).block(); + } + + /** + * Restart virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 virtualMachineName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .restart( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + virtualMachineName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Restart virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 virtualMachineName, 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.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .restart( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + virtualMachineName, + accept, + context); + } + + /** + * Restart virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync(String resourceGroupName, String virtualMachineName) { + Mono>> mono = restartWithResponseAsync(resourceGroupName, virtualMachineName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Restart virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync( + String resourceGroupName, String virtualMachineName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + restartWithResponseAsync(resourceGroupName, virtualMachineName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Restart virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart(String resourceGroupName, String virtualMachineName) { + return beginRestartAsync(resourceGroupName, virtualMachineName).getSyncPoller(); + } + + /** + * Restart virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart( + String resourceGroupName, String virtualMachineName, Context context) { + return beginRestartAsync(resourceGroupName, virtualMachineName, context).getSyncPoller(); + } + + /** + * Restart virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 virtualMachineName) { + return beginRestartAsync(resourceGroupName, virtualMachineName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restart virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 virtualMachineName, Context context) { + return beginRestartAsync(resourceGroupName, virtualMachineName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restart virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void restart(String resourceGroupName, String virtualMachineName) { + restartAsync(resourceGroupName, virtualMachineName).block(); + } + + /** + * Restart virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void restart(String resourceGroupName, String virtualMachineName, Context context) { + restartAsync(resourceGroupName, virtualMachineName, context).block(); + } + + /** + * Creates a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine create checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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>> createCheckpointWithResponseAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineCreateCheckpoint body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createCheckpoint( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + virtualMachineName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine create checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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>> createCheckpointWithResponseAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineCreateCheckpoint body, 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.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createCheckpoint( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + virtualMachineName, + body, + accept, + context); + } + + /** + * Creates a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine create checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginCreateCheckpointAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineCreateCheckpoint body) { + Mono>> mono = + createCheckpointWithResponseAsync(resourceGroupName, virtualMachineName, body); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Creates a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine create checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginCreateCheckpointAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineCreateCheckpoint body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createCheckpointWithResponseAsync(resourceGroupName, virtualMachineName, body, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Creates a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine create checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginCreateCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineCreateCheckpoint body) { + return beginCreateCheckpointAsync(resourceGroupName, virtualMachineName, body).getSyncPoller(); + } + + /** + * Creates a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine create checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginCreateCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineCreateCheckpoint body, Context context) { + return beginCreateCheckpointAsync(resourceGroupName, virtualMachineName, body, context).getSyncPoller(); + } + + /** + * Creates a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine create checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 createCheckpointAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineCreateCheckpoint body) { + return beginCreateCheckpointAsync(resourceGroupName, virtualMachineName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 createCheckpointAsync(String resourceGroupName, String virtualMachineName) { + final VirtualMachineCreateCheckpoint body = null; + return beginCreateCheckpointAsync(resourceGroupName, virtualMachineName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine create checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 createCheckpointAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineCreateCheckpoint body, Context context) { + return beginCreateCheckpointAsync(resourceGroupName, virtualMachineName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine create checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 createCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineCreateCheckpoint body) { + createCheckpointAsync(resourceGroupName, virtualMachineName, body).block(); + } + + /** + * Creates a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 createCheckpoint(String resourceGroupName, String virtualMachineName) { + final VirtualMachineCreateCheckpoint body = null; + createCheckpointAsync(resourceGroupName, virtualMachineName, body).block(); + } + + /** + * Creates a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine create checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 createCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineCreateCheckpoint body, Context context) { + createCheckpointAsync(resourceGroupName, virtualMachineName, body, context).block(); + } + + /** + * Deletes a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine delete checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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>> deleteCheckpointWithResponseAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineDeleteCheckpoint body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteCheckpoint( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + virtualMachineName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine delete checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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>> deleteCheckpointWithResponseAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineDeleteCheckpoint body, 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.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteCheckpoint( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + virtualMachineName, + body, + accept, + context); + } + + /** + * Deletes a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine delete checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteCheckpointAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineDeleteCheckpoint body) { + Mono>> mono = + deleteCheckpointWithResponseAsync(resourceGroupName, virtualMachineName, body); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine delete checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteCheckpointAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineDeleteCheckpoint body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteCheckpointWithResponseAsync(resourceGroupName, virtualMachineName, body, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine delete checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineDeleteCheckpoint body) { + return beginDeleteCheckpointAsync(resourceGroupName, virtualMachineName, body).getSyncPoller(); + } + + /** + * Deletes a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine delete checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineDeleteCheckpoint body, Context context) { + return beginDeleteCheckpointAsync(resourceGroupName, virtualMachineName, body, context).getSyncPoller(); + } + + /** + * Deletes a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine delete checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 deleteCheckpointAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineDeleteCheckpoint body) { + return beginDeleteCheckpointAsync(resourceGroupName, virtualMachineName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 deleteCheckpointAsync(String resourceGroupName, String virtualMachineName) { + final VirtualMachineDeleteCheckpoint body = null; + return beginDeleteCheckpointAsync(resourceGroupName, virtualMachineName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine delete checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 deleteCheckpointAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineDeleteCheckpoint body, Context context) { + return beginDeleteCheckpointAsync(resourceGroupName, virtualMachineName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine delete checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 deleteCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineDeleteCheckpoint body) { + deleteCheckpointAsync(resourceGroupName, virtualMachineName, body).block(); + } + + /** + * Deletes a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 deleteCheckpoint(String resourceGroupName, String virtualMachineName) { + final VirtualMachineDeleteCheckpoint body = null; + deleteCheckpointAsync(resourceGroupName, virtualMachineName, body).block(); + } + + /** + * Deletes a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine delete checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 deleteCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineDeleteCheckpoint body, Context context) { + deleteCheckpointAsync(resourceGroupName, virtualMachineName, body, context).block(); + } + + /** + * Restores to a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine restore checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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>> restoreCheckpointWithResponseAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineRestoreCheckpoint body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .restoreCheckpoint( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + virtualMachineName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Restores to a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine restore checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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>> restoreCheckpointWithResponseAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineRestoreCheckpoint body, 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.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .restoreCheckpoint( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + virtualMachineName, + body, + accept, + context); + } + + /** + * Restores to a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine restore checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestoreCheckpointAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineRestoreCheckpoint body) { + Mono>> mono = + restoreCheckpointWithResponseAsync(resourceGroupName, virtualMachineName, body); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Restores to a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine restore checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestoreCheckpointAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineRestoreCheckpoint body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + restoreCheckpointWithResponseAsync(resourceGroupName, virtualMachineName, body, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Restores to a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine restore checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestoreCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineRestoreCheckpoint body) { + return beginRestoreCheckpointAsync(resourceGroupName, virtualMachineName, body).getSyncPoller(); + } + + /** + * Restores to a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine restore checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestoreCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineRestoreCheckpoint body, Context context) { + return beginRestoreCheckpointAsync(resourceGroupName, virtualMachineName, body, context).getSyncPoller(); + } + + /** + * Restores to a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine restore checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 restoreCheckpointAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineRestoreCheckpoint body) { + return beginRestoreCheckpointAsync(resourceGroupName, virtualMachineName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restores to a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 restoreCheckpointAsync(String resourceGroupName, String virtualMachineName) { + final VirtualMachineRestoreCheckpoint body = null; + return beginRestoreCheckpointAsync(resourceGroupName, virtualMachineName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restores to a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine restore checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 restoreCheckpointAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineRestoreCheckpoint body, Context context) { + return beginRestoreCheckpointAsync(resourceGroupName, virtualMachineName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restores to a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine restore checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 restoreCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineRestoreCheckpoint body) { + restoreCheckpointAsync(resourceGroupName, virtualMachineName, body).block(); + } + + /** + * Restores to a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 restoreCheckpoint(String resourceGroupName, String virtualMachineName) { + final VirtualMachineRestoreCheckpoint body = null; + restoreCheckpointAsync(resourceGroupName, virtualMachineName, body).block(); + } + + /** + * Restores to a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine restore checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 restoreCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineRestoreCheckpoint body, Context context) { + restoreCheckpointAsync(resourceGroupName, virtualMachineName, body, context).block(); + } + + /** + * List of VirtualMachines in 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 list of VirtualMachines along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List of VirtualMachines 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 ManagementException 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 VirtualMachines along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List of VirtualMachines in 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 list of VirtualMachines as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List of VirtualMachines 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 ManagementException 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 VirtualMachines as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List of VirtualMachines in 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 list of VirtualMachines as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List of VirtualMachines 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 ManagementException 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 VirtualMachines as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * List of VirtualMachines in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualMachines along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List of VirtualMachines in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualMachines along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List of VirtualMachines in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualMachines as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List of VirtualMachines in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualMachines as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List of VirtualMachines in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualMachines as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List of VirtualMachines in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualMachines as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 list of VirtualMachines 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 list of VirtualMachines 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 list of VirtualMachines 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 ManagementException 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 VirtualMachines 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/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualMachinesImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualMachinesImpl.java new file mode 100644 index 0000000000000..5df67adcbef1b --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualMachinesImpl.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.scvmm.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.scvmm.fluent.VirtualMachinesClient; +import com.azure.resourcemanager.scvmm.fluent.models.VirtualMachineInner; +import com.azure.resourcemanager.scvmm.models.StopVirtualMachineOptions; +import com.azure.resourcemanager.scvmm.models.VirtualMachine; +import com.azure.resourcemanager.scvmm.models.VirtualMachineCreateCheckpoint; +import com.azure.resourcemanager.scvmm.models.VirtualMachineDeleteCheckpoint; +import com.azure.resourcemanager.scvmm.models.VirtualMachineRestoreCheckpoint; +import com.azure.resourcemanager.scvmm.models.VirtualMachines; + +public final class VirtualMachinesImpl implements VirtualMachines { + private static final ClientLogger LOGGER = new ClientLogger(VirtualMachinesImpl.class); + + private final VirtualMachinesClient innerClient; + + private final com.azure.resourcemanager.scvmm.ScvmmManager serviceManager; + + public VirtualMachinesImpl( + VirtualMachinesClient innerClient, com.azure.resourcemanager.scvmm.ScvmmManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public VirtualMachine getByResourceGroup(String resourceGroupName, String virtualMachineName) { + VirtualMachineInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, virtualMachineName); + if (inner != null) { + return new VirtualMachineImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualMachineName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, virtualMachineName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualMachineImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String virtualMachineName, Boolean retain, Boolean force) { + this.serviceClient().delete(resourceGroupName, virtualMachineName, retain, force); + } + + public void delete(String resourceGroupName, String virtualMachineName) { + this.serviceClient().delete(resourceGroupName, virtualMachineName); + } + + public void delete( + String resourceGroupName, String virtualMachineName, Boolean retain, Boolean force, Context context) { + this.serviceClient().delete(resourceGroupName, virtualMachineName, retain, force, context); + } + + public void stop(String resourceGroupName, String virtualMachineName, StopVirtualMachineOptions body) { + this.serviceClient().stop(resourceGroupName, virtualMachineName, body); + } + + public void stop(String resourceGroupName, String virtualMachineName) { + this.serviceClient().stop(resourceGroupName, virtualMachineName); + } + + public void stop( + String resourceGroupName, String virtualMachineName, StopVirtualMachineOptions body, Context context) { + this.serviceClient().stop(resourceGroupName, virtualMachineName, body, context); + } + + public void start(String resourceGroupName, String virtualMachineName) { + this.serviceClient().start(resourceGroupName, virtualMachineName); + } + + public void start(String resourceGroupName, String virtualMachineName, Context context) { + this.serviceClient().start(resourceGroupName, virtualMachineName, context); + } + + public void restart(String resourceGroupName, String virtualMachineName) { + this.serviceClient().restart(resourceGroupName, virtualMachineName); + } + + public void restart(String resourceGroupName, String virtualMachineName, Context context) { + this.serviceClient().restart(resourceGroupName, virtualMachineName, context); + } + + public void createCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineCreateCheckpoint body) { + this.serviceClient().createCheckpoint(resourceGroupName, virtualMachineName, body); + } + + public void createCheckpoint(String resourceGroupName, String virtualMachineName) { + this.serviceClient().createCheckpoint(resourceGroupName, virtualMachineName); + } + + public void createCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineCreateCheckpoint body, Context context) { + this.serviceClient().createCheckpoint(resourceGroupName, virtualMachineName, body, context); + } + + public void deleteCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineDeleteCheckpoint body) { + this.serviceClient().deleteCheckpoint(resourceGroupName, virtualMachineName, body); + } + + public void deleteCheckpoint(String resourceGroupName, String virtualMachineName) { + this.serviceClient().deleteCheckpoint(resourceGroupName, virtualMachineName); + } + + public void deleteCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineDeleteCheckpoint body, Context context) { + this.serviceClient().deleteCheckpoint(resourceGroupName, virtualMachineName, body, context); + } + + public void restoreCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineRestoreCheckpoint body) { + this.serviceClient().restoreCheckpoint(resourceGroupName, virtualMachineName, body); + } + + public void restoreCheckpoint(String resourceGroupName, String virtualMachineName) { + this.serviceClient().restoreCheckpoint(resourceGroupName, virtualMachineName); + } + + public void restoreCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineRestoreCheckpoint body, Context context) { + this.serviceClient().restoreCheckpoint(resourceGroupName, virtualMachineName, body, 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, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, 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(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new VirtualMachineImpl(inner1, this.manager())); + } + + 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 virtualMachineName = Utils.getValueFromIdByName(id, "virtualMachines"); + if (virtualMachineName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, virtualMachineName, 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 virtualMachineName = Utils.getValueFromIdByName(id, "virtualMachines"); + if (virtualMachineName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, virtualMachineName, 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 virtualMachineName = Utils.getValueFromIdByName(id, "virtualMachines"); + if (virtualMachineName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + Boolean localRetain = null; + Boolean localForce = null; + this.delete(resourceGroupName, virtualMachineName, localRetain, localForce, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Boolean retain, Boolean force, 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 virtualMachineName = Utils.getValueFromIdByName(id, "virtualMachines"); + if (virtualMachineName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + this.delete(resourceGroupName, virtualMachineName, retain, force, context); + } + + private VirtualMachinesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.scvmm.ScvmmManager manager() { + return this.serviceManager; + } + + public VirtualMachineImpl define(String name) { + return new VirtualMachineImpl(name, this.manager()); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualNetworkImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualNetworkImpl.java new file mode 100644 index 0000000000000..5b674d7599672 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualNetworkImpl.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.scvmm.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.fluent.models.VirtualNetworkInner; +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; +import com.azure.resourcemanager.scvmm.models.ResourcePatch; +import com.azure.resourcemanager.scvmm.models.VirtualNetwork; +import java.util.Collections; +import java.util.Map; + +public final class VirtualNetworkImpl implements VirtualNetwork, VirtualNetwork.Definition, VirtualNetwork.Update { + private VirtualNetworkInner innerObject; + + private final com.azure.resourcemanager.scvmm.ScvmmManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public String inventoryItemId() { + return this.innerModel().inventoryItemId(); + } + + public String uuid() { + return this.innerModel().uuid(); + } + + public String vmmServerId() { + return this.innerModel().vmmServerId(); + } + + public String networkName() { + return this.innerModel().networkName(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public VirtualNetworkInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.scvmm.ScvmmManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String virtualNetworkName; + + private ResourcePatch updateBody; + + public VirtualNetworkImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public VirtualNetwork create() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworks() + .createOrUpdate(resourceGroupName, virtualNetworkName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualNetwork create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworks() + .createOrUpdate(resourceGroupName, virtualNetworkName, this.innerModel(), context); + return this; + } + + VirtualNetworkImpl(String name, com.azure.resourcemanager.scvmm.ScvmmManager serviceManager) { + this.innerObject = new VirtualNetworkInner(); + this.serviceManager = serviceManager; + this.virtualNetworkName = name; + } + + public VirtualNetworkImpl update() { + this.updateBody = new ResourcePatch(); + return this; + } + + public VirtualNetwork apply() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworks() + .update(resourceGroupName, virtualNetworkName, updateBody, Context.NONE); + return this; + } + + public VirtualNetwork apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworks() + .update(resourceGroupName, virtualNetworkName, updateBody, context); + return this; + } + + VirtualNetworkImpl(VirtualNetworkInner innerObject, com.azure.resourcemanager.scvmm.ScvmmManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.virtualNetworkName = Utils.getValueFromIdByName(innerObject.id(), "virtualNetworks"); + } + + public VirtualNetwork refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworks() + .getByResourceGroupWithResponse(resourceGroupName, virtualNetworkName, Context.NONE) + .getValue(); + return this; + } + + public VirtualNetwork refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworks() + .getByResourceGroupWithResponse(resourceGroupName, virtualNetworkName, context) + .getValue(); + return this; + } + + public VirtualNetworkImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public VirtualNetworkImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public VirtualNetworkImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public VirtualNetworkImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public VirtualNetworkImpl withInventoryItemId(String inventoryItemId) { + this.innerModel().withInventoryItemId(inventoryItemId); + return this; + } + + public VirtualNetworkImpl withUuid(String uuid) { + this.innerModel().withUuid(uuid); + return this; + } + + public VirtualNetworkImpl withVmmServerId(String vmmServerId) { + this.innerModel().withVmmServerId(vmmServerId); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualNetworksClientImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualNetworksClientImpl.java new file mode 100644 index 0000000000000..54a30f20e63eb --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualNetworksClientImpl.java @@ -0,0 +1,1611 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.scvmm.fluent.VirtualNetworksClient; +import com.azure.resourcemanager.scvmm.fluent.models.VirtualNetworkInner; +import com.azure.resourcemanager.scvmm.models.ResourcePatch; +import com.azure.resourcemanager.scvmm.models.VirtualNetworkListResult; +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 VirtualNetworksClient. */ +public final class VirtualNetworksClientImpl implements VirtualNetworksClient { + /** The proxy service used to perform REST calls. */ + private final VirtualNetworksService service; + + /** The service client containing this operation class. */ + private final ScvmmClientImpl client; + + /** + * Initializes an instance of VirtualNetworksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualNetworksClientImpl(ScvmmClientImpl client) { + this.service = + RestProxy.create(VirtualNetworksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ScvmmClientVirtualNetworks to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ScvmmClientVirtualNe") + private interface VirtualNetworksService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/virtualNetworks/{virtualNetworkName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualNetworkName") String virtualNetworkName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/virtualNetworks/{virtualNetworkName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualNetworkName") String virtualNetworkName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") VirtualNetworkInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/virtualNetworks/{virtualNetworkName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualNetworkName") String virtualNetworkName, + @QueryParam("api-version") String apiVersion, + @QueryParam("force") Boolean force, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/virtualNetworks/{virtualNetworkName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("virtualNetworkName") String virtualNetworkName, + @BodyParam("application/json") ResourcePatch body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm" + + "/virtualNetworks") + @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.ScVmm/virtualNetworks") + @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"}) + @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> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Implements VirtualNetwork GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String virtualNetworkName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (virtualNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualNetworkName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements VirtualNetwork GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String virtualNetworkName, 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 (virtualNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualNetworkName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Implements VirtualNetwork GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String virtualNetworkName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, virtualNetworkName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Implements VirtualNetwork GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkInner getByResourceGroup(String resourceGroupName, String virtualNetworkName) { + return getByResourceGroupAsync(resourceGroupName, virtualNetworkName).block(); + } + + /** + * Implements VirtualNetwork GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualNetworkName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, virtualNetworkName, context).block(); + } + + /** + * Onboards the ScVmm virtual network as an Azure virtual network resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualNetworkName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Onboards the ScVmm virtual network as an Azure virtual network resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualNetworkName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Onboards the ScVmm virtual network as an Azure virtual network resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualNetworkInner> beginCreateOrUpdateAsync( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, virtualNetworkName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualNetworkInner.class, + VirtualNetworkInner.class, + this.client.getContext()); + } + + /** + * Onboards the ScVmm virtual network as an Azure virtual network resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualNetworkInner> beginCreateOrUpdateAsync( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, virtualNetworkName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), VirtualNetworkInner.class, VirtualNetworkInner.class, context); + } + + /** + * Onboards the ScVmm virtual network as an Azure virtual network resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualNetworkInner> beginCreateOrUpdate( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, virtualNetworkName, body).getSyncPoller(); + } + + /** + * Onboards the ScVmm virtual network as an Azure virtual network resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualNetworkInner> beginCreateOrUpdate( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, virtualNetworkName, body, context).getSyncPoller(); + } + + /** + * Onboards the ScVmm virtual network as an Azure virtual network resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, virtualNetworkName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Onboards the ScVmm virtual network as an Azure virtual network resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, virtualNetworkName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Onboards the ScVmm virtual network as an Azure virtual network resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkInner createOrUpdate( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body) { + return createOrUpdateAsync(resourceGroupName, virtualNetworkName, body).block(); + } + + /** + * Onboards the ScVmm virtual network as an Azure virtual network resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkInner createOrUpdate( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body, Context context) { + return createOrUpdateAsync(resourceGroupName, virtualNetworkName, body, context).block(); + } + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 virtualNetworkName, Boolean force) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (virtualNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualNetworkName, + this.client.getApiVersion(), + force, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 virtualNetworkName, Boolean force, 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 (virtualNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualNetworkName, + this.client.getApiVersion(), + force, + accept, + context); + } + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String virtualNetworkName, Boolean force) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, virtualNetworkName, force); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String virtualNetworkName, Boolean force, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, virtualNetworkName, force, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String virtualNetworkName, Boolean force) { + return beginDeleteAsync(resourceGroupName, virtualNetworkName, force).getSyncPoller(); + } + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String virtualNetworkName, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, virtualNetworkName, force, context).getSyncPoller(); + } + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 virtualNetworkName, Boolean force) { + return beginDeleteAsync(resourceGroupName, virtualNetworkName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 virtualNetworkName) { + final Boolean force = null; + return beginDeleteAsync(resourceGroupName, virtualNetworkName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 virtualNetworkName, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, virtualNetworkName, force, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 virtualNetworkName, Boolean force) { + deleteAsync(resourceGroupName, virtualNetworkName, force).block(); + } + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 virtualNetworkName) { + final Boolean force = null; + deleteAsync(resourceGroupName, virtualNetworkName, force).block(); + } + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 virtualNetworkName, Boolean force, Context context) { + deleteAsync(resourceGroupName, virtualNetworkName, force, context).block(); + } + + /** + * Updates the VirtualNetworks resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body VirtualNetworks patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String virtualNetworkName, ResourcePatch body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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.")); + } + if (virtualNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + virtualNetworkName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the VirtualNetworks resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body VirtualNetworks patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String virtualNetworkName, ResourcePatch body, 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.")); + } + if (virtualNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + virtualNetworkName, + body, + accept, + context); + } + + /** + * Updates the VirtualNetworks resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body VirtualNetworks patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualNetworkInner> beginUpdateAsync( + String resourceGroupName, String virtualNetworkName, ResourcePatch body) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, virtualNetworkName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualNetworkInner.class, + VirtualNetworkInner.class, + this.client.getContext()); + } + + /** + * Updates the VirtualNetworks resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body VirtualNetworks patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualNetworkInner> beginUpdateAsync( + String resourceGroupName, String virtualNetworkName, ResourcePatch body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, virtualNetworkName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), VirtualNetworkInner.class, VirtualNetworkInner.class, context); + } + + /** + * Updates the VirtualNetworks resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body VirtualNetworks patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualNetworkInner> beginUpdate( + String resourceGroupName, String virtualNetworkName, ResourcePatch body) { + return beginUpdateAsync(resourceGroupName, virtualNetworkName, body).getSyncPoller(); + } + + /** + * Updates the VirtualNetworks resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body VirtualNetworks patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualNetworkInner> beginUpdate( + String resourceGroupName, String virtualNetworkName, ResourcePatch body, Context context) { + return beginUpdateAsync(resourceGroupName, virtualNetworkName, body, context).getSyncPoller(); + } + + /** + * Updates the VirtualNetworks resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body VirtualNetworks patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String virtualNetworkName, ResourcePatch body) { + return beginUpdateAsync(resourceGroupName, virtualNetworkName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the VirtualNetworks resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body VirtualNetworks patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String virtualNetworkName, ResourcePatch body, Context context) { + return beginUpdateAsync(resourceGroupName, virtualNetworkName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the VirtualNetworks resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body VirtualNetworks patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkInner update(String resourceGroupName, String virtualNetworkName, ResourcePatch body) { + return updateAsync(resourceGroupName, virtualNetworkName, body).block(); + } + + /** + * Updates the VirtualNetworks resource. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param body VirtualNetworks patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkInner update( + String resourceGroupName, String virtualNetworkName, ResourcePatch body, Context context) { + return updateAsync(resourceGroupName, virtualNetworkName, body, context).block(); + } + + /** + * List of VirtualNetworks in 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 list of VirtualNetworks along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List of VirtualNetworks 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 ManagementException 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 VirtualNetworks along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List of VirtualNetworks in 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 list of VirtualNetworks as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List of VirtualNetworks 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 ManagementException 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 VirtualNetworks as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List of VirtualNetworks in 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 list of VirtualNetworks as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List of VirtualNetworks 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 ManagementException 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 VirtualNetworks as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * List of VirtualNetworks in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualNetworks along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List of VirtualNetworks in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualNetworks along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List of VirtualNetworks in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualNetworks as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List of VirtualNetworks in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualNetworks as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List of VirtualNetworks in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualNetworks as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List of VirtualNetworks in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualNetworks as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 list of VirtualNetworks 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 list of VirtualNetworks 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 list of VirtualNetworks 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 ManagementException 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 VirtualNetworks 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/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualNetworksImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualNetworksImpl.java new file mode 100644 index 0000000000000..08e84a969e40d --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VirtualNetworksImpl.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.scvmm.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.scvmm.fluent.VirtualNetworksClient; +import com.azure.resourcemanager.scvmm.fluent.models.VirtualNetworkInner; +import com.azure.resourcemanager.scvmm.models.VirtualNetwork; +import com.azure.resourcemanager.scvmm.models.VirtualNetworks; + +public final class VirtualNetworksImpl implements VirtualNetworks { + private static final ClientLogger LOGGER = new ClientLogger(VirtualNetworksImpl.class); + + private final VirtualNetworksClient innerClient; + + private final com.azure.resourcemanager.scvmm.ScvmmManager serviceManager; + + public VirtualNetworksImpl( + VirtualNetworksClient innerClient, com.azure.resourcemanager.scvmm.ScvmmManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public VirtualNetwork getByResourceGroup(String resourceGroupName, String virtualNetworkName) { + VirtualNetworkInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, virtualNetworkName); + if (inner != null) { + return new VirtualNetworkImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualNetworkName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, virtualNetworkName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualNetworkImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String virtualNetworkName, Boolean force) { + this.serviceClient().delete(resourceGroupName, virtualNetworkName, force); + } + + public void delete(String resourceGroupName, String virtualNetworkName) { + this.serviceClient().delete(resourceGroupName, virtualNetworkName); + } + + public void delete(String resourceGroupName, String virtualNetworkName, Boolean force, Context context) { + this.serviceClient().delete(resourceGroupName, virtualNetworkName, force, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new VirtualNetworkImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new VirtualNetworkImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new VirtualNetworkImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new VirtualNetworkImpl(inner1, this.manager())); + } + + public VirtualNetwork 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 virtualNetworkName = Utils.getValueFromIdByName(id, "virtualNetworks"); + if (virtualNetworkName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualNetworks'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, virtualNetworkName, 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 virtualNetworkName = Utils.getValueFromIdByName(id, "virtualNetworks"); + if (virtualNetworkName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualNetworks'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, virtualNetworkName, 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 virtualNetworkName = Utils.getValueFromIdByName(id, "virtualNetworks"); + if (virtualNetworkName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualNetworks'.", id))); + } + Boolean localForce = null; + this.delete(resourceGroupName, virtualNetworkName, localForce, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Boolean force, 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 virtualNetworkName = Utils.getValueFromIdByName(id, "virtualNetworks"); + if (virtualNetworkName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualNetworks'.", id))); + } + this.delete(resourceGroupName, virtualNetworkName, force, context); + } + + private VirtualNetworksClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.scvmm.ScvmmManager manager() { + return this.serviceManager; + } + + public VirtualNetworkImpl define(String name) { + return new VirtualNetworkImpl(name, this.manager()); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VmmServerImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VmmServerImpl.java new file mode 100644 index 0000000000000..b2928a3b1a951 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VmmServerImpl.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.scvmm.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.fluent.models.VmmServerInner; +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; +import com.azure.resourcemanager.scvmm.models.ResourcePatch; +import com.azure.resourcemanager.scvmm.models.VmmServer; +import com.azure.resourcemanager.scvmm.models.VmmServerPropertiesCredentials; +import java.util.Collections; +import java.util.Map; + +public final class VmmServerImpl implements VmmServer, VmmServer.Definition, VmmServer.Update { + private VmmServerInner innerObject; + + private final com.azure.resourcemanager.scvmm.ScvmmManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public VmmServerPropertiesCredentials credentials() { + return this.innerModel().credentials(); + } + + public String fqdn() { + return this.innerModel().fqdn(); + } + + public Integer port() { + return this.innerModel().port(); + } + + public String connectionStatus() { + return this.innerModel().connectionStatus(); + } + + public String errorMessage() { + return this.innerModel().errorMessage(); + } + + public String uuid() { + return this.innerModel().uuid(); + } + + public String version() { + return this.innerModel().version(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public VmmServerInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.scvmm.ScvmmManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String vmmServerName; + + private ResourcePatch updateBody; + + public VmmServerImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public VmmServer create() { + this.innerObject = + serviceManager + .serviceClient() + .getVmmServers() + .createOrUpdate(resourceGroupName, vmmServerName, this.innerModel(), Context.NONE); + return this; + } + + public VmmServer create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVmmServers() + .createOrUpdate(resourceGroupName, vmmServerName, this.innerModel(), context); + return this; + } + + VmmServerImpl(String name, com.azure.resourcemanager.scvmm.ScvmmManager serviceManager) { + this.innerObject = new VmmServerInner(); + this.serviceManager = serviceManager; + this.vmmServerName = name; + } + + public VmmServerImpl update() { + this.updateBody = new ResourcePatch(); + return this; + } + + public VmmServer apply() { + this.innerObject = + serviceManager + .serviceClient() + .getVmmServers() + .update(resourceGroupName, vmmServerName, updateBody, Context.NONE); + return this; + } + + public VmmServer apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVmmServers() + .update(resourceGroupName, vmmServerName, updateBody, context); + return this; + } + + VmmServerImpl(VmmServerInner innerObject, com.azure.resourcemanager.scvmm.ScvmmManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.vmmServerName = Utils.getValueFromIdByName(innerObject.id(), "vmmServers"); + } + + public VmmServer refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getVmmServers() + .getByResourceGroupWithResponse(resourceGroupName, vmmServerName, Context.NONE) + .getValue(); + return this; + } + + public VmmServer refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVmmServers() + .getByResourceGroupWithResponse(resourceGroupName, vmmServerName, context) + .getValue(); + return this; + } + + public VmmServerImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public VmmServerImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public VmmServerImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public VmmServerImpl withFqdn(String fqdn) { + this.innerModel().withFqdn(fqdn); + return this; + } + + public VmmServerImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public VmmServerImpl withCredentials(VmmServerPropertiesCredentials credentials) { + this.innerModel().withCredentials(credentials); + return this; + } + + public VmmServerImpl withPort(Integer port) { + this.innerModel().withPort(port); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VmmServersClientImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VmmServersClientImpl.java new file mode 100644 index 0000000000000..71c1e632b9f05 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VmmServersClientImpl.java @@ -0,0 +1,1590 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.scvmm.fluent.VmmServersClient; +import com.azure.resourcemanager.scvmm.fluent.models.VmmServerInner; +import com.azure.resourcemanager.scvmm.models.ResourcePatch; +import com.azure.resourcemanager.scvmm.models.VmmServerListResult; +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 VmmServersClient. */ +public final class VmmServersClientImpl implements VmmServersClient { + /** The proxy service used to perform REST calls. */ + private final VmmServersService service; + + /** The service client containing this operation class. */ + private final ScvmmClientImpl client; + + /** + * Initializes an instance of VmmServersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VmmServersClientImpl(ScvmmClientImpl client) { + this.service = + RestProxy.create(VmmServersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ScvmmClientVmmServers to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ScvmmClientVmmServer") + private interface VmmServersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers" + + "/{vmmServerName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmmServerName") String vmmServerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers" + + "/{vmmServerName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmmServerName") String vmmServerName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") VmmServerInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers" + + "/{vmmServerName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vmmServerName") String vmmServerName, + @QueryParam("api-version") String apiVersion, + @QueryParam("force") Boolean force, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers" + + "/{vmmServerName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("vmmServerName") String vmmServerName, + @BodyParam("application/json") ResourcePatch body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers") + @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.ScVmm/vmmServers") + @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"}) + @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> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Implements VMMServer GET method. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String vmmServerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (vmmServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmmServerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vmmServerName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements VMMServer GET method. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String vmmServerName, 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 (vmmServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmmServerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vmmServerName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Implements VMMServer GET method. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String vmmServerName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, vmmServerName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Implements VMMServer GET method. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VmmServerInner getByResourceGroup(String resourceGroupName, String vmmServerName) { + return getByResourceGroupAsync(resourceGroupName, vmmServerName).block(); + } + + /** + * Implements VMMServer GET method. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String vmmServerName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, vmmServerName, context).block(); + } + + /** + * Onboards the SCVMM fabric as an Azure VmmServer resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String vmmServerName, VmmServerInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmmServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmmServerName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vmmServerName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Onboards the SCVMM fabric as an Azure VmmServer resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String vmmServerName, VmmServerInner body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vmmServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmmServerName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vmmServerName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Onboards the SCVMM fabric as an Azure VmmServer resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VmmServerInner> beginCreateOrUpdateAsync( + String resourceGroupName, String vmmServerName, VmmServerInner body) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, vmmServerName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VmmServerInner.class, + VmmServerInner.class, + this.client.getContext()); + } + + /** + * Onboards the SCVMM fabric as an Azure VmmServer resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VmmServerInner> beginCreateOrUpdateAsync( + String resourceGroupName, String vmmServerName, VmmServerInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, vmmServerName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), VmmServerInner.class, VmmServerInner.class, context); + } + + /** + * Onboards the SCVMM fabric as an Azure VmmServer resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VmmServerInner> beginCreateOrUpdate( + String resourceGroupName, String vmmServerName, VmmServerInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, vmmServerName, body).getSyncPoller(); + } + + /** + * Onboards the SCVMM fabric as an Azure VmmServer resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VmmServerInner> beginCreateOrUpdate( + String resourceGroupName, String vmmServerName, VmmServerInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, vmmServerName, body, context).getSyncPoller(); + } + + /** + * Onboards the SCVMM fabric as an Azure VmmServer resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String vmmServerName, VmmServerInner body) { + return beginCreateOrUpdateAsync(resourceGroupName, vmmServerName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Onboards the SCVMM fabric as an Azure VmmServer resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String vmmServerName, VmmServerInner body, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, vmmServerName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Onboards the SCVMM fabric as an Azure VmmServer resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body Request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VmmServerInner createOrUpdate(String resourceGroupName, String vmmServerName, VmmServerInner body) { + return createOrUpdateAsync(resourceGroupName, vmmServerName, body).block(); + } + + /** + * Onboards the SCVMM fabric as an Azure VmmServer resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body Request payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VmmServerInner createOrUpdate( + String resourceGroupName, String vmmServerName, VmmServerInner body, Context context) { + return createOrUpdateAsync(resourceGroupName, vmmServerName, body, context).block(); + } + + /** + * Deboards the SCVMM fabric from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 vmmServerName, Boolean force) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (vmmServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmmServerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vmmServerName, + this.client.getApiVersion(), + force, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deboards the SCVMM fabric from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 vmmServerName, Boolean force, 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 (vmmServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmmServerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vmmServerName, + this.client.getApiVersion(), + force, + accept, + context); + } + + /** + * Deboards the SCVMM fabric from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String vmmServerName, Boolean force) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, vmmServerName, force); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deboards the SCVMM fabric from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String vmmServerName, Boolean force, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, vmmServerName, force, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deboards the SCVMM fabric from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String vmmServerName, Boolean force) { + return beginDeleteAsync(resourceGroupName, vmmServerName, force).getSyncPoller(); + } + + /** + * Deboards the SCVMM fabric from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String vmmServerName, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, vmmServerName, force, context).getSyncPoller(); + } + + /** + * Deboards the SCVMM fabric from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 vmmServerName, Boolean force) { + return beginDeleteAsync(resourceGroupName, vmmServerName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deboards the SCVMM fabric from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 vmmServerName) { + final Boolean force = null; + return beginDeleteAsync(resourceGroupName, vmmServerName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deboards the SCVMM fabric from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 vmmServerName, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, vmmServerName, force, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deboards the SCVMM fabric from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 vmmServerName, Boolean force) { + deleteAsync(resourceGroupName, vmmServerName, force).block(); + } + + /** + * Deboards the SCVMM fabric from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 vmmServerName) { + final Boolean force = null; + deleteAsync(resourceGroupName, vmmServerName, force).block(); + } + + /** + * Deboards the SCVMM fabric from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 vmmServerName, Boolean force, Context context) { + deleteAsync(resourceGroupName, vmmServerName, force, context).block(); + } + + /** + * Updates the VmmServers resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body VmmServers patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String vmmServerName, ResourcePatch body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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.")); + } + if (vmmServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmmServerName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + vmmServerName, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the VmmServers resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body VmmServers patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String vmmServerName, ResourcePatch body, 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.")); + } + if (vmmServerName == null) { + return Mono.error(new IllegalArgumentException("Parameter vmmServerName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + vmmServerName, + body, + accept, + context); + } + + /** + * Updates the VmmServers resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body VmmServers patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VmmServerInner> beginUpdateAsync( + String resourceGroupName, String vmmServerName, ResourcePatch body) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, vmmServerName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VmmServerInner.class, + VmmServerInner.class, + this.client.getContext()); + } + + /** + * Updates the VmmServers resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body VmmServers patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VmmServerInner> beginUpdateAsync( + String resourceGroupName, String vmmServerName, ResourcePatch body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, vmmServerName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), VmmServerInner.class, VmmServerInner.class, context); + } + + /** + * Updates the VmmServers resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body VmmServers patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VmmServerInner> beginUpdate( + String resourceGroupName, String vmmServerName, ResourcePatch body) { + return beginUpdateAsync(resourceGroupName, vmmServerName, body).getSyncPoller(); + } + + /** + * Updates the VmmServers resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body VmmServers patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VmmServerInner> beginUpdate( + String resourceGroupName, String vmmServerName, ResourcePatch body, Context context) { + return beginUpdateAsync(resourceGroupName, vmmServerName, body, context).getSyncPoller(); + } + + /** + * Updates the VmmServers resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body VmmServers patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String vmmServerName, ResourcePatch body) { + return beginUpdateAsync(resourceGroupName, vmmServerName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the VmmServers resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body VmmServers patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String vmmServerName, ResourcePatch body, Context context) { + return beginUpdateAsync(resourceGroupName, vmmServerName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the VmmServers resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body VmmServers patch payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VmmServerInner update(String resourceGroupName, String vmmServerName, ResourcePatch body) { + return updateAsync(resourceGroupName, vmmServerName, body).block(); + } + + /** + * Updates the VmmServers resource. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param body VmmServers patch payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VmmServerInner update(String resourceGroupName, String vmmServerName, ResourcePatch body, Context context) { + return updateAsync(resourceGroupName, vmmServerName, body, context).block(); + } + + /** + * List of VmmServers in 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 list of VmmServers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List of VmmServers 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 ManagementException 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 VmmServers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List of VmmServers in 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 list of VmmServers as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List of VmmServers 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 ManagementException 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 VmmServers as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List of VmmServers in 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 list of VmmServers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List of VmmServers 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 ManagementException 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 VmmServers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * List of VmmServers in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VmmServers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List of VmmServers in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VmmServers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List of VmmServers in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VmmServers as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List of VmmServers in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VmmServers as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List of VmmServers in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VmmServers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List of VmmServers in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VmmServers as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 list of VmmServers 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 list of VmmServers 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 list of VmmServers 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 ManagementException 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 VmmServers 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/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VmmServersImpl.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VmmServersImpl.java new file mode 100644 index 0000000000000..d37c1c505c3ce --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/VmmServersImpl.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.scvmm.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.scvmm.fluent.VmmServersClient; +import com.azure.resourcemanager.scvmm.fluent.models.VmmServerInner; +import com.azure.resourcemanager.scvmm.models.VmmServer; +import com.azure.resourcemanager.scvmm.models.VmmServers; + +public final class VmmServersImpl implements VmmServers { + private static final ClientLogger LOGGER = new ClientLogger(VmmServersImpl.class); + + private final VmmServersClient innerClient; + + private final com.azure.resourcemanager.scvmm.ScvmmManager serviceManager; + + public VmmServersImpl(VmmServersClient innerClient, com.azure.resourcemanager.scvmm.ScvmmManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public VmmServer getByResourceGroup(String resourceGroupName, String vmmServerName) { + VmmServerInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, vmmServerName); + if (inner != null) { + return new VmmServerImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String vmmServerName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, vmmServerName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VmmServerImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String vmmServerName, Boolean force) { + this.serviceClient().delete(resourceGroupName, vmmServerName, force); + } + + public void delete(String resourceGroupName, String vmmServerName) { + this.serviceClient().delete(resourceGroupName, vmmServerName); + } + + public void delete(String resourceGroupName, String vmmServerName, Boolean force, Context context) { + this.serviceClient().delete(resourceGroupName, vmmServerName, force, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new VmmServerImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new VmmServerImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new VmmServerImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new VmmServerImpl(inner1, this.manager())); + } + + public VmmServer 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 vmmServerName = Utils.getValueFromIdByName(id, "vmmServers"); + if (vmmServerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vmmServers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, vmmServerName, 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 vmmServerName = Utils.getValueFromIdByName(id, "vmmServers"); + if (vmmServerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vmmServers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, vmmServerName, 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 vmmServerName = Utils.getValueFromIdByName(id, "vmmServers"); + if (vmmServerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vmmServers'.", id))); + } + Boolean localForce = null; + this.delete(resourceGroupName, vmmServerName, localForce, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Boolean force, 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 vmmServerName = Utils.getValueFromIdByName(id, "vmmServers"); + if (vmmServerName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vmmServers'.", id))); + } + this.delete(resourceGroupName, vmmServerName, force, context); + } + + private VmmServersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.scvmm.ScvmmManager manager() { + return this.serviceManager; + } + + public VmmServerImpl define(String name) { + return new VmmServerImpl(name, this.manager()); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/package-info.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/implementation/package-info.java new file mode 100644 index 0000000000000..9cf3910742e10 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/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 ScvmmClient. SCVMM Client. */ +package com.azure.resourcemanager.scvmm.implementation; diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/AllocationMethod.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/AllocationMethod.java new file mode 100644 index 0000000000000..c1f562163bba2 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/AllocationMethod.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.scvmm.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AllocationMethod. */ +public final class AllocationMethod extends ExpandableStringEnum { + /** Static value Dynamic for AllocationMethod. */ + public static final AllocationMethod DYNAMIC = fromString("Dynamic"); + + /** Static value Static for AllocationMethod. */ + public static final AllocationMethod STATIC = fromString("Static"); + + /** + * Creates or finds a AllocationMethod from its string representation. + * + * @param name a name to look for. + * @return the corresponding AllocationMethod. + */ + @JsonCreator + public static AllocationMethod fromString(String name) { + return fromString(name, AllocationMethod.class); + } + + /** @return known AllocationMethod values. */ + public static Collection values() { + return values(AllocationMethod.class); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/AvailabilitySet.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/AvailabilitySet.java new file mode 100644 index 0000000000000..1fca8d2df70fb --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/AvailabilitySet.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.scvmm.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.fluent.models.AvailabilitySetInner; +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 systemData property: The system data. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the extendedLocation property: The extended location. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the availabilitySetName property: Name of the availability set. + * + * @return the availabilitySetName value. + */ + String availabilitySetName(); + + /** + * Gets the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @return the vmmServerId value. + */ + String vmmServerId(); + + /** + * Gets the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.scvmm.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.WithExtendedLocation, + DefinitionStages.WithAvailabilitySetName, + DefinitionStages.WithVmmServerId { + /** + * 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 extendedLocation. */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extended location.. + * + * @param extendedLocation The extended location. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + /** The stage of the AvailabilitySet definition allowing to specify availabilitySetName. */ + interface WithAvailabilitySetName { + /** + * Specifies the availabilitySetName property: Name of the availability set.. + * + * @param availabilitySetName Name of the availability set. + * @return the next definition stage. + */ + WithCreate withAvailabilitySetName(String availabilitySetName); + } + /** The stage of the AvailabilitySet definition allowing to specify vmmServerId. */ + interface WithVmmServerId { + /** + * Specifies the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides.. + * + * @param vmmServerId ARM Id of the vmmServer resource in which this resource resides. + * @return the next definition stage. + */ + WithCreate withVmmServerId(String vmmServerId); + } + } + /** + * 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 { + /** + * 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); + } + } + /** + * 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/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/AvailabilitySetListItem.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/AvailabilitySetListItem.java new file mode 100644 index 0000000000000..d2fac544cb93b --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/AvailabilitySetListItem.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Availability Set model. */ +@Fluent +public final class AvailabilitySetListItem { + /* + * Gets the ARM Id of the microsoft.scvmm/availabilitySets resource. + */ + @JsonProperty(value = "id") + private String id; + + /* + * Gets or sets the name of the availability set. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the id property: Gets the ARM Id of the microsoft.scvmm/availabilitySets resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Gets the ARM Id of the microsoft.scvmm/availabilitySets resource. + * + * @param id the id value to set. + * @return the AvailabilitySetListItem object itself. + */ + public AvailabilitySetListItem withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: Gets or sets the name of the availability set. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets or sets the name of the availability set. + * + * @param name the name value to set. + * @return the AvailabilitySetListItem object itself. + */ + public AvailabilitySetListItem withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/AvailabilitySetListResult.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/AvailabilitySetListResult.java new file mode 100644 index 0000000000000..9f72c9e2423be --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/AvailabilitySetListResult.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.scvmm.fluent.models.AvailabilitySetInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of AvailabilitySets. */ +@Fluent +public final class AvailabilitySetListResult { + /* + * List of AvailabilitySets. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Url to follow for getting next page of resources. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of AvailabilitySets. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of AvailabilitySets. + * + * @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: Url to follow for getting next page of resources. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to follow for getting next page of resources. + * + * @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) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/AvailabilitySets.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/AvailabilitySets.java new file mode 100644 index 0000000000000..0b27b75297745 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/AvailabilitySets.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.scvmm.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 { + /** + * Implements AvailabilitySet GET method. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition. + */ + AvailabilitySet getByResourceGroup(String resourceGroupName, String availabilitySetName); + + /** + * Implements AvailabilitySet GET method. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String availabilitySetName, Context context); + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 availabilitySetName, Boolean force); + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 availabilitySetName); + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName Name of the AvailabilitySet. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 availabilitySetName, Boolean force, Context context); + + /** + * List of AvailabilitySets in 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 list of AvailabilitySets as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of AvailabilitySets 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.core.management.exception.ManagementException 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 AvailabilitySets as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List of AvailabilitySets in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of AvailabilitySets as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List of AvailabilitySets in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of AvailabilitySets as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Implements AvailabilitySet GET method. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition along with {@link Response}. + */ + AvailabilitySet getById(String id); + + /** + * Implements AvailabilitySet GET method. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the AvailabilitySets resource definition along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @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); + + /** + * Deregisters the ScVmm availability set from Azure. + * + * @param id the resource ID. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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, Boolean force, 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/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/Checkpoint.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/Checkpoint.java new file mode 100644 index 0000000000000..df85ae7a2a055 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/Checkpoint.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the resource properties. */ +@Fluent +public final class Checkpoint { + /* + * Gets ID of parent of the checkpoint. + */ + @JsonProperty(value = "parentCheckpointID") + private String parentCheckpointId; + + /* + * Gets ID of the checkpoint. + */ + @JsonProperty(value = "checkpointID") + private String checkpointId; + + /* + * Gets name of the checkpoint. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Gets description of the checkpoint. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the parentCheckpointId property: Gets ID of parent of the checkpoint. + * + * @return the parentCheckpointId value. + */ + public String parentCheckpointId() { + return this.parentCheckpointId; + } + + /** + * Set the parentCheckpointId property: Gets ID of parent of the checkpoint. + * + * @param parentCheckpointId the parentCheckpointId value to set. + * @return the Checkpoint object itself. + */ + public Checkpoint withParentCheckpointId(String parentCheckpointId) { + this.parentCheckpointId = parentCheckpointId; + return this; + } + + /** + * Get the checkpointId property: Gets ID of the checkpoint. + * + * @return the checkpointId value. + */ + public String checkpointId() { + return this.checkpointId; + } + + /** + * Set the checkpointId property: Gets ID of the checkpoint. + * + * @param checkpointId the checkpointId value to set. + * @return the Checkpoint object itself. + */ + public Checkpoint withCheckpointId(String checkpointId) { + this.checkpointId = checkpointId; + return this; + } + + /** + * Get the name property: Gets name of the checkpoint. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets name of the checkpoint. + * + * @param name the name value to set. + * @return the Checkpoint object itself. + */ + public Checkpoint withName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: Gets description of the checkpoint. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Gets description of the checkpoint. + * + * @param description the description value to set. + * @return the Checkpoint object itself. + */ + public Checkpoint withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/Cloud.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/Cloud.java new file mode 100644 index 0000000000000..1707591135bdf --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/Cloud.java @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.fluent.models.CloudInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Cloud. */ +public interface Cloud { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: The system data. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the extendedLocation property: The extended location. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @return the inventoryItemId value. + */ + String inventoryItemId(); + + /** + * Gets the uuid property: Unique ID of the cloud. + * + * @return the uuid value. + */ + String uuid(); + + /** + * Gets the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @return the vmmServerId value. + */ + String vmmServerId(); + + /** + * Gets the cloudName property: Name of the cloud in VMMServer. + * + * @return the cloudName value. + */ + String cloudName(); + + /** + * Gets the cloudCapacity property: Capacity of the cloud. + * + * @return the cloudCapacity value. + */ + CloudCapacity cloudCapacity(); + + /** + * Gets the storageQoSPolicies property: List of QoS policies available for the cloud. + * + * @return the storageQoSPolicies value. + */ + List storageQoSPolicies(); + + /** + * Gets the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.scvmm.fluent.models.CloudInner object. + * + * @return the inner object. + */ + CloudInner innerModel(); + + /** The entirety of the Cloud definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithExtendedLocation, + DefinitionStages.WithCreate { + } + /** The Cloud definition stages. */ + interface DefinitionStages { + /** The first stage of the Cloud definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Cloud 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 Cloud definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithExtendedLocation withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the Cloud definition allowing to specify extendedLocation. */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extended location.. + * + * @param extendedLocation The extended location. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + /** + * The stage of the Cloud 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.WithInventoryItemId, + DefinitionStages.WithUuid, + DefinitionStages.WithVmmServerId { + /** + * Executes the create request. + * + * @return the created resource. + */ + Cloud create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Cloud create(Context context); + } + /** The stage of the Cloud 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 Cloud definition allowing to specify inventoryItemId. */ + interface WithInventoryItemId { + /** + * Specifies the inventoryItemId property: Gets or sets the inventory Item ID for the resource.. + * + * @param inventoryItemId Gets or sets the inventory Item ID for the resource. + * @return the next definition stage. + */ + WithCreate withInventoryItemId(String inventoryItemId); + } + /** The stage of the Cloud definition allowing to specify uuid. */ + interface WithUuid { + /** + * Specifies the uuid property: Unique ID of the cloud.. + * + * @param uuid Unique ID of the cloud. + * @return the next definition stage. + */ + WithCreate withUuid(String uuid); + } + /** The stage of the Cloud definition allowing to specify vmmServerId. */ + interface WithVmmServerId { + /** + * Specifies the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides.. + * + * @param vmmServerId ARM Id of the vmmServer resource in which this resource resides. + * @return the next definition stage. + */ + WithCreate withVmmServerId(String vmmServerId); + } + } + /** + * Begins update for the Cloud resource. + * + * @return the stage of resource update. + */ + Cloud.Update update(); + + /** The template for Cloud update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Cloud apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Cloud apply(Context context); + } + /** The Cloud update stages. */ + interface UpdateStages { + /** The stage of the Cloud 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. + */ + Cloud refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Cloud refresh(Context context); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/CloudCapacity.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/CloudCapacity.java new file mode 100644 index 0000000000000..6639bb7b937ea --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/CloudCapacity.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cloud Capacity model. */ +@Fluent +public final class CloudCapacity { + /* + * CPUCount specifies the maximum number of CPUs that can be allocated in + * the cloud. + */ + @JsonProperty(value = "cpuCount") + private Long cpuCount; + + /* + * MemoryMB specifies a memory usage limit in megabytes. + */ + @JsonProperty(value = "memoryMB") + private Long memoryMB; + + /* + * VMCount gives the max number of VMs that can be deployed in the cloud. + */ + @JsonProperty(value = "vmCount") + private Long vmCount; + + /** + * Get the cpuCount property: CPUCount specifies the maximum number of CPUs that can be allocated in the cloud. + * + * @return the cpuCount value. + */ + public Long cpuCount() { + return this.cpuCount; + } + + /** + * Set the cpuCount property: CPUCount specifies the maximum number of CPUs that can be allocated in the cloud. + * + * @param cpuCount the cpuCount value to set. + * @return the CloudCapacity object itself. + */ + public CloudCapacity withCpuCount(Long cpuCount) { + this.cpuCount = cpuCount; + return this; + } + + /** + * Get the memoryMB property: MemoryMB specifies a memory usage limit in megabytes. + * + * @return the memoryMB value. + */ + public Long memoryMB() { + return this.memoryMB; + } + + /** + * Set the memoryMB property: MemoryMB specifies a memory usage limit in megabytes. + * + * @param memoryMB the memoryMB value to set. + * @return the CloudCapacity object itself. + */ + public CloudCapacity withMemoryMB(Long memoryMB) { + this.memoryMB = memoryMB; + return this; + } + + /** + * Get the vmCount property: VMCount gives the max number of VMs that can be deployed in the cloud. + * + * @return the vmCount value. + */ + public Long vmCount() { + return this.vmCount; + } + + /** + * Set the vmCount property: VMCount gives the max number of VMs that can be deployed in the cloud. + * + * @param vmCount the vmCount value to set. + * @return the CloudCapacity object itself. + */ + public CloudCapacity withVmCount(Long vmCount) { + this.vmCount = vmCount; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/CloudInventoryItem.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/CloudInventoryItem.java new file mode 100644 index 0000000000000..dd97551cbf771 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/CloudInventoryItem.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.scvmm.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.scvmm.fluent.models.InventoryItemProperties; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The Cloud inventory item. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "inventoryType") +@JsonTypeName("Cloud") +@Immutable +public final class CloudInventoryItem extends InventoryItemProperties { + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/CloudListResult.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/CloudListResult.java new file mode 100644 index 0000000000000..82cb0707bb5a0 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/CloudListResult.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.scvmm.fluent.models.CloudInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of Clouds. */ +@Fluent +public final class CloudListResult { + /* + * List of Clouds. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Url to follow for getting next page of resources. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of Clouds. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of Clouds. + * + * @param value the value value to set. + * @return the CloudListResult object itself. + */ + public CloudListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Url to follow for getting next page of resources. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to follow for getting next page of resources. + * + * @param nextLink the nextLink value to set. + * @return the CloudListResult object itself. + */ + public CloudListResult 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/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/Clouds.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/Clouds.java new file mode 100644 index 0000000000000..779d9e35f7a54 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/Clouds.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.scvmm.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 Clouds. */ +public interface Clouds { + /** + * Implements Cloud GET method. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition. + */ + Cloud getByResourceGroup(String resourceGroupName, String cloudName); + + /** + * Implements Cloud GET method. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String cloudName, Context context); + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 cloudName, Boolean force); + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 cloudName); + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param cloudName Name of the Cloud. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 cloudName, Boolean force, Context context); + + /** + * List of Clouds in 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 list of Clouds as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of Clouds 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.core.management.exception.ManagementException 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 Clouds as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List of Clouds in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Clouds as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List of Clouds in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Clouds as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Implements Cloud GET method. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition along with {@link Response}. + */ + Cloud getById(String id); + + /** + * Implements Cloud GET method. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Clouds resource definition along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @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); + + /** + * Deregisters the ScVmm fabric cloud from Azure. + * + * @param id the resource ID. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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, Boolean force, Context context); + + /** + * Begins definition for a new Cloud resource. + * + * @param name resource name. + * @return the first stage of the new Cloud definition. + */ + Cloud.DefinitionStages.Blank define(String name); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/CreateDiffDisk.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/CreateDiffDisk.java new file mode 100644 index 0000000000000..ffaef12dcd712 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/CreateDiffDisk.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.scvmm.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CreateDiffDisk. */ +public final class CreateDiffDisk extends ExpandableStringEnum { + /** Static value false for CreateDiffDisk. */ + public static final CreateDiffDisk FALSE = fromString("false"); + + /** Static value true for CreateDiffDisk. */ + public static final CreateDiffDisk TRUE = fromString("true"); + + /** + * Creates or finds a CreateDiffDisk from its string representation. + * + * @param name a name to look for. + * @return the corresponding CreateDiffDisk. + */ + @JsonCreator + public static CreateDiffDisk fromString(String name) { + return fromString(name, CreateDiffDisk.class); + } + + /** @return known CreateDiffDisk values. */ + public static Collection values() { + return values(CreateDiffDisk.class); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/DynamicMemoryEnabled.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/DynamicMemoryEnabled.java new file mode 100644 index 0000000000000..0a0e1296bead7 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/DynamicMemoryEnabled.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.scvmm.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DynamicMemoryEnabled. */ +public final class DynamicMemoryEnabled extends ExpandableStringEnum { + /** Static value false for DynamicMemoryEnabled. */ + public static final DynamicMemoryEnabled FALSE = fromString("false"); + + /** Static value true for DynamicMemoryEnabled. */ + public static final DynamicMemoryEnabled TRUE = fromString("true"); + + /** + * Creates or finds a DynamicMemoryEnabled from its string representation. + * + * @param name a name to look for. + * @return the corresponding DynamicMemoryEnabled. + */ + @JsonCreator + public static DynamicMemoryEnabled fromString(String name) { + return fromString(name, DynamicMemoryEnabled.class); + } + + /** @return known DynamicMemoryEnabled values. */ + public static Collection values() { + return values(DynamicMemoryEnabled.class); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/ExtendedLocation.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/ExtendedLocation.java new file mode 100644 index 0000000000000..c28f2b95619ba --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/ExtendedLocation.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The extended location. */ +@Fluent +public final class ExtendedLocation { + /* + * The extended location type. + */ + @JsonProperty(value = "type") + private String type; + + /* + * The extended location name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the type property: The extended location type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The extended location type. + * + * @param type the type value to set. + * @return the ExtendedLocation object itself. + */ + public ExtendedLocation withType(String type) { + this.type = type; + return this; + } + + /** + * Get the name property: The extended location name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The extended location name. + * + * @param name the name value to set. + * @return the ExtendedLocation object itself. + */ + public ExtendedLocation withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/HardwareProfile.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/HardwareProfile.java new file mode 100644 index 0000000000000..1b8da7e567827 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/HardwareProfile.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the resource properties. */ +@Fluent +public final class HardwareProfile { + /* + * MemoryMB is the size of a virtual machine's memory, in MB. + */ + @JsonProperty(value = "memoryMB") + private Integer memoryMB; + + /* + * Gets or sets the number of vCPUs for the vm. + */ + @JsonProperty(value = "cpuCount") + private Integer cpuCount; + + /* + * Gets or sets a value indicating whether to enable processor + * compatibility mode for live migration of VMs. + */ + @JsonProperty(value = "limitCpuForMigration") + private LimitCpuForMigration limitCpuForMigration; + + /* + * Gets or sets a value indicating whether to enable dynamic memory or not. + */ + @JsonProperty(value = "dynamicMemoryEnabled") + private DynamicMemoryEnabled dynamicMemoryEnabled; + + /* + * Gets or sets the max dynamic memory for the vm. + */ + @JsonProperty(value = "dynamicMemoryMaxMB") + private Integer dynamicMemoryMaxMB; + + /* + * Gets or sets the min dynamic memory for the vm. + */ + @JsonProperty(value = "dynamicMemoryMinMB") + private Integer dynamicMemoryMinMB; + + /* + * Gets highly available property. + */ + @JsonProperty(value = "isHighlyAvailable") + private String isHighlyAvailable; + + /** + * Get the memoryMB property: MemoryMB is the size of a virtual machine's memory, in MB. + * + * @return the memoryMB value. + */ + public Integer memoryMB() { + return this.memoryMB; + } + + /** + * Set the memoryMB property: MemoryMB is the size of a virtual machine's memory, in MB. + * + * @param memoryMB the memoryMB value to set. + * @return the HardwareProfile object itself. + */ + public HardwareProfile withMemoryMB(Integer memoryMB) { + this.memoryMB = memoryMB; + return this; + } + + /** + * Get the cpuCount property: Gets or sets the number of vCPUs for the vm. + * + * @return the cpuCount value. + */ + public Integer cpuCount() { + return this.cpuCount; + } + + /** + * Set the cpuCount property: Gets or sets the number of vCPUs for the vm. + * + * @param cpuCount the cpuCount value to set. + * @return the HardwareProfile object itself. + */ + public HardwareProfile withCpuCount(Integer cpuCount) { + this.cpuCount = cpuCount; + return this; + } + + /** + * Get the limitCpuForMigration property: Gets or sets a value indicating whether to enable processor compatibility + * mode for live migration of VMs. + * + * @return the limitCpuForMigration value. + */ + public LimitCpuForMigration limitCpuForMigration() { + return this.limitCpuForMigration; + } + + /** + * Set the limitCpuForMigration property: Gets or sets a value indicating whether to enable processor compatibility + * mode for live migration of VMs. + * + * @param limitCpuForMigration the limitCpuForMigration value to set. + * @return the HardwareProfile object itself. + */ + public HardwareProfile withLimitCpuForMigration(LimitCpuForMigration limitCpuForMigration) { + this.limitCpuForMigration = limitCpuForMigration; + return this; + } + + /** + * Get the dynamicMemoryEnabled property: Gets or sets a value indicating whether to enable dynamic memory or not. + * + * @return the dynamicMemoryEnabled value. + */ + public DynamicMemoryEnabled dynamicMemoryEnabled() { + return this.dynamicMemoryEnabled; + } + + /** + * Set the dynamicMemoryEnabled property: Gets or sets a value indicating whether to enable dynamic memory or not. + * + * @param dynamicMemoryEnabled the dynamicMemoryEnabled value to set. + * @return the HardwareProfile object itself. + */ + public HardwareProfile withDynamicMemoryEnabled(DynamicMemoryEnabled dynamicMemoryEnabled) { + this.dynamicMemoryEnabled = dynamicMemoryEnabled; + return this; + } + + /** + * Get the dynamicMemoryMaxMB property: Gets or sets the max dynamic memory for the vm. + * + * @return the dynamicMemoryMaxMB value. + */ + public Integer dynamicMemoryMaxMB() { + return this.dynamicMemoryMaxMB; + } + + /** + * Set the dynamicMemoryMaxMB property: Gets or sets the max dynamic memory for the vm. + * + * @param dynamicMemoryMaxMB the dynamicMemoryMaxMB value to set. + * @return the HardwareProfile object itself. + */ + public HardwareProfile withDynamicMemoryMaxMB(Integer dynamicMemoryMaxMB) { + this.dynamicMemoryMaxMB = dynamicMemoryMaxMB; + return this; + } + + /** + * Get the dynamicMemoryMinMB property: Gets or sets the min dynamic memory for the vm. + * + * @return the dynamicMemoryMinMB value. + */ + public Integer dynamicMemoryMinMB() { + return this.dynamicMemoryMinMB; + } + + /** + * Set the dynamicMemoryMinMB property: Gets or sets the min dynamic memory for the vm. + * + * @param dynamicMemoryMinMB the dynamicMemoryMinMB value to set. + * @return the HardwareProfile object itself. + */ + public HardwareProfile withDynamicMemoryMinMB(Integer dynamicMemoryMinMB) { + this.dynamicMemoryMinMB = dynamicMemoryMinMB; + return this; + } + + /** + * Get the isHighlyAvailable property: Gets highly available property. + * + * @return the isHighlyAvailable value. + */ + public String isHighlyAvailable() { + return this.isHighlyAvailable; + } + + /** + * Set the isHighlyAvailable property: Gets highly available property. + * + * @param isHighlyAvailable the isHighlyAvailable value to set. + * @return the HardwareProfile object itself. + */ + public HardwareProfile withIsHighlyAvailable(String isHighlyAvailable) { + this.isHighlyAvailable = isHighlyAvailable; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/HardwareProfileUpdate.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/HardwareProfileUpdate.java new file mode 100644 index 0000000000000..b12a5c7329e0b --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/HardwareProfileUpdate.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the resource properties. */ +@Fluent +public final class HardwareProfileUpdate { + /* + * MemoryMB is the size of a virtual machine's memory, in MB. + */ + @JsonProperty(value = "memoryMB") + private Integer memoryMB; + + /* + * Gets or sets the number of vCPUs for the vm. + */ + @JsonProperty(value = "cpuCount") + private Integer cpuCount; + + /* + * Gets or sets a value indicating whether to enable processor + * compatibility mode for live migration of VMs. + */ + @JsonProperty(value = "limitCpuForMigration") + private LimitCpuForMigration limitCpuForMigration; + + /* + * Gets or sets a value indicating whether to enable dynamic memory or not. + */ + @JsonProperty(value = "dynamicMemoryEnabled") + private DynamicMemoryEnabled dynamicMemoryEnabled; + + /* + * Gets or sets the max dynamic memory for the vm. + */ + @JsonProperty(value = "dynamicMemoryMaxMB") + private Integer dynamicMemoryMaxMB; + + /* + * Gets or sets the min dynamic memory for the vm. + */ + @JsonProperty(value = "dynamicMemoryMinMB") + private Integer dynamicMemoryMinMB; + + /** + * Get the memoryMB property: MemoryMB is the size of a virtual machine's memory, in MB. + * + * @return the memoryMB value. + */ + public Integer memoryMB() { + return this.memoryMB; + } + + /** + * Set the memoryMB property: MemoryMB is the size of a virtual machine's memory, in MB. + * + * @param memoryMB the memoryMB value to set. + * @return the HardwareProfileUpdate object itself. + */ + public HardwareProfileUpdate withMemoryMB(Integer memoryMB) { + this.memoryMB = memoryMB; + return this; + } + + /** + * Get the cpuCount property: Gets or sets the number of vCPUs for the vm. + * + * @return the cpuCount value. + */ + public Integer cpuCount() { + return this.cpuCount; + } + + /** + * Set the cpuCount property: Gets or sets the number of vCPUs for the vm. + * + * @param cpuCount the cpuCount value to set. + * @return the HardwareProfileUpdate object itself. + */ + public HardwareProfileUpdate withCpuCount(Integer cpuCount) { + this.cpuCount = cpuCount; + return this; + } + + /** + * Get the limitCpuForMigration property: Gets or sets a value indicating whether to enable processor compatibility + * mode for live migration of VMs. + * + * @return the limitCpuForMigration value. + */ + public LimitCpuForMigration limitCpuForMigration() { + return this.limitCpuForMigration; + } + + /** + * Set the limitCpuForMigration property: Gets or sets a value indicating whether to enable processor compatibility + * mode for live migration of VMs. + * + * @param limitCpuForMigration the limitCpuForMigration value to set. + * @return the HardwareProfileUpdate object itself. + */ + public HardwareProfileUpdate withLimitCpuForMigration(LimitCpuForMigration limitCpuForMigration) { + this.limitCpuForMigration = limitCpuForMigration; + return this; + } + + /** + * Get the dynamicMemoryEnabled property: Gets or sets a value indicating whether to enable dynamic memory or not. + * + * @return the dynamicMemoryEnabled value. + */ + public DynamicMemoryEnabled dynamicMemoryEnabled() { + return this.dynamicMemoryEnabled; + } + + /** + * Set the dynamicMemoryEnabled property: Gets or sets a value indicating whether to enable dynamic memory or not. + * + * @param dynamicMemoryEnabled the dynamicMemoryEnabled value to set. + * @return the HardwareProfileUpdate object itself. + */ + public HardwareProfileUpdate withDynamicMemoryEnabled(DynamicMemoryEnabled dynamicMemoryEnabled) { + this.dynamicMemoryEnabled = dynamicMemoryEnabled; + return this; + } + + /** + * Get the dynamicMemoryMaxMB property: Gets or sets the max dynamic memory for the vm. + * + * @return the dynamicMemoryMaxMB value. + */ + public Integer dynamicMemoryMaxMB() { + return this.dynamicMemoryMaxMB; + } + + /** + * Set the dynamicMemoryMaxMB property: Gets or sets the max dynamic memory for the vm. + * + * @param dynamicMemoryMaxMB the dynamicMemoryMaxMB value to set. + * @return the HardwareProfileUpdate object itself. + */ + public HardwareProfileUpdate withDynamicMemoryMaxMB(Integer dynamicMemoryMaxMB) { + this.dynamicMemoryMaxMB = dynamicMemoryMaxMB; + return this; + } + + /** + * Get the dynamicMemoryMinMB property: Gets or sets the min dynamic memory for the vm. + * + * @return the dynamicMemoryMinMB value. + */ + public Integer dynamicMemoryMinMB() { + return this.dynamicMemoryMinMB; + } + + /** + * Set the dynamicMemoryMinMB property: Gets or sets the min dynamic memory for the vm. + * + * @param dynamicMemoryMinMB the dynamicMemoryMinMB value to set. + * @return the HardwareProfileUpdate object itself. + */ + public HardwareProfileUpdate withDynamicMemoryMinMB(Integer dynamicMemoryMinMB) { + this.dynamicMemoryMinMB = dynamicMemoryMinMB; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/InventoryItem.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/InventoryItem.java new file mode 100644 index 0000000000000..dab51031a1745 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/InventoryItem.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.fluent.models.InventoryItemInner; + +/** An immutable client-side representation of InventoryItem. */ +public interface InventoryItem { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: The system data. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the kind property: Metadata used by portal/tooling/etc to render different UX experiences for resources of + * the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must + * validate and persist this value. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the managedResourceId property: Gets the tracked resource id corresponding to the inventory resource. + * + * @return the managedResourceId value. + */ + String managedResourceId(); + + /** + * Gets the uuid property: Gets the UUID (which is assigned by VMM) for the inventory item. + * + * @return the uuid value. + */ + String uuid(); + + /** + * Gets the inventoryItemName property: Gets the Managed Object name in VMM for the inventory item. + * + * @return the inventoryItemName value. + */ + String inventoryItemName(); + + /** + * Gets the provisioningState property: Gets the provisioning state. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.scvmm.fluent.models.InventoryItemInner object. + * + * @return the inner object. + */ + InventoryItemInner innerModel(); + + /** The entirety of the InventoryItem definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The InventoryItem definition stages. */ + interface DefinitionStages { + /** The first stage of the InventoryItem definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the InventoryItem definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, vmmServerName. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @return the next definition stage. + */ + WithCreate withExistingVmmServer(String resourceGroupName, String vmmServerName); + } + /** + * The stage of the InventoryItem 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.WithKind { + /** + * Executes the create request. + * + * @return the created resource. + */ + InventoryItem create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + InventoryItem create(Context context); + } + /** The stage of the InventoryItem definition allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: Metadata used by portal/tooling/etc to render different UX experiences for + * resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the + * resource provider must validate and persist this value.. + * + * @param kind Metadata used by portal/tooling/etc to render different UX experiences for resources of the + * same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider + * must validate and persist this value. + * @return the next definition stage. + */ + WithCreate withKind(String kind); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + InventoryItem refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + InventoryItem refresh(Context context); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/InventoryItemDetails.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/InventoryItemDetails.java new file mode 100644 index 0000000000000..a982e282f4c38 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/InventoryItemDetails.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the resource properties. */ +@Fluent +public final class InventoryItemDetails { + /* + * Gets or sets the inventory Item ID for the resource. + */ + @JsonProperty(value = "inventoryItemId") + private String inventoryItemId; + + /* + * Gets or sets the Managed Object name in VMM for the resource. + */ + @JsonProperty(value = "inventoryItemName") + private String inventoryItemName; + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @return the inventoryItemId value. + */ + public String inventoryItemId() { + return this.inventoryItemId; + } + + /** + * Set the inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @param inventoryItemId the inventoryItemId value to set. + * @return the InventoryItemDetails object itself. + */ + public InventoryItemDetails withInventoryItemId(String inventoryItemId) { + this.inventoryItemId = inventoryItemId; + return this; + } + + /** + * Get the inventoryItemName property: Gets or sets the Managed Object name in VMM for the resource. + * + * @return the inventoryItemName value. + */ + public String inventoryItemName() { + return this.inventoryItemName; + } + + /** + * Set the inventoryItemName property: Gets or sets the Managed Object name in VMM for the resource. + * + * @param inventoryItemName the inventoryItemName value to set. + * @return the InventoryItemDetails object itself. + */ + public InventoryItemDetails withInventoryItemName(String inventoryItemName) { + this.inventoryItemName = inventoryItemName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/InventoryItems.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/InventoryItems.java new file mode 100644 index 0000000000000..86b9ac3b571c3 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/InventoryItems.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.scvmm.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 InventoryItems. */ +public interface InventoryItems { + /** + * Shows an inventory item. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the inventory item. + */ + InventoryItem get(String resourceGroupName, String vmmServerName, String inventoryItemName); + + /** + * Shows an inventory item. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the inventory item along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String vmmServerName, String inventoryItemName, Context context); + + /** + * Deletes an inventoryItem. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 vmmServerName, String inventoryItemName); + + /** + * Deletes an inventoryItem. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param inventoryItemName Name of the inventoryItem. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 vmmServerName, String inventoryItemName, Context context); + + /** + * Returns the list of inventoryItems in the given VMMServer. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 InventoryItems as paginated response with {@link PagedIterable}. + */ + PagedIterable listByVmmServer(String resourceGroupName, String vmmServerName); + + /** + * Returns the list of inventoryItems in the given VMMServer. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 InventoryItems as paginated response with {@link PagedIterable}. + */ + PagedIterable listByVmmServer(String resourceGroupName, String vmmServerName, Context context); + + /** + * Shows an inventory item. + * + * @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 defines the inventory item along with {@link Response}. + */ + InventoryItem getById(String id); + + /** + * Shows an inventory item. + * + * @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 defines the inventory item along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an inventoryItem. + * + * @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 an inventoryItem. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new InventoryItem resource. + * + * @param name resource name. + * @return the first stage of the new InventoryItem definition. + */ + InventoryItem.DefinitionStages.Blank define(String name); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/InventoryItemsList.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/InventoryItemsList.java new file mode 100644 index 0000000000000..fdb246a7e0fe0 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/InventoryItemsList.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.scvmm.fluent.models.InventoryItemInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of InventoryItems. */ +@Fluent +public final class InventoryItemsList { + /* + * Url to follow for getting next page of InventoryItems. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * Array of InventoryItems + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the nextLink property: Url to follow for getting next page of InventoryItems. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to follow for getting next page of InventoryItems. + * + * @param nextLink the nextLink value to set. + * @return the InventoryItemsList object itself. + */ + public InventoryItemsList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: Array of InventoryItems. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of InventoryItems. + * + * @param value the value value to set. + * @return the InventoryItemsList object itself. + */ + public InventoryItemsList 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model InventoryItemsList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(InventoryItemsList.class); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/InventoryType.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/InventoryType.java new file mode 100644 index 0000000000000..0193534fe0634 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/InventoryType.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.scvmm.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for InventoryType. */ +public final class InventoryType extends ExpandableStringEnum { + /** Static value Cloud for InventoryType. */ + public static final InventoryType CLOUD = fromString("Cloud"); + + /** Static value VirtualNetwork for InventoryType. */ + public static final InventoryType VIRTUAL_NETWORK = fromString("VirtualNetwork"); + + /** Static value VirtualMachineTemplate for InventoryType. */ + public static final InventoryType VIRTUAL_MACHINE_TEMPLATE = fromString("VirtualMachineTemplate"); + + /** Static value VirtualMachine for InventoryType. */ + public static final InventoryType VIRTUAL_MACHINE = fromString("VirtualMachine"); + + /** + * Creates or finds a InventoryType from its string representation. + * + * @param name a name to look for. + * @return the corresponding InventoryType. + */ + @JsonCreator + public static InventoryType fromString(String name) { + return fromString(name, InventoryType.class); + } + + /** @return known InventoryType values. */ + public static Collection values() { + return values(InventoryType.class); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/IsCustomizable.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/IsCustomizable.java new file mode 100644 index 0000000000000..2dc66d7524e75 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/IsCustomizable.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.scvmm.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for IsCustomizable. */ +public final class IsCustomizable extends ExpandableStringEnum { + /** Static value false for IsCustomizable. */ + public static final IsCustomizable FALSE = fromString("false"); + + /** Static value true for IsCustomizable. */ + public static final IsCustomizable TRUE = fromString("true"); + + /** + * Creates or finds a IsCustomizable from its string representation. + * + * @param name a name to look for. + * @return the corresponding IsCustomizable. + */ + @JsonCreator + public static IsCustomizable fromString(String name) { + return fromString(name, IsCustomizable.class); + } + + /** @return known IsCustomizable values. */ + public static Collection values() { + return values(IsCustomizable.class); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/LimitCpuForMigration.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/LimitCpuForMigration.java new file mode 100644 index 0000000000000..8a1c25a1c89f8 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/LimitCpuForMigration.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.scvmm.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for LimitCpuForMigration. */ +public final class LimitCpuForMigration extends ExpandableStringEnum { + /** Static value false for LimitCpuForMigration. */ + public static final LimitCpuForMigration FALSE = fromString("false"); + + /** Static value true for LimitCpuForMigration. */ + public static final LimitCpuForMigration TRUE = fromString("true"); + + /** + * Creates or finds a LimitCpuForMigration from its string representation. + * + * @param name a name to look for. + * @return the corresponding LimitCpuForMigration. + */ + @JsonCreator + public static LimitCpuForMigration fromString(String name) { + return fromString(name, LimitCpuForMigration.class); + } + + /** @return known LimitCpuForMigration values. */ + public static Collection values() { + return values(LimitCpuForMigration.class); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/NetworkInterfaces.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/NetworkInterfaces.java new file mode 100644 index 0000000000000..e639639a348af --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/NetworkInterfaces.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Network Interface model. */ +@Fluent +public final class NetworkInterfaces { + /* + * Gets or sets the name of the network interface. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Gets the display name of the network interface as shown in the + * vmmServer. This is the fallback label for a NIC when the name is not + * set. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * Gets or sets the nic ipv4 addresses. + */ + @JsonProperty(value = "ipv4Addresses", access = JsonProperty.Access.WRITE_ONLY) + private List ipv4Addresses; + + /* + * Gets or sets the nic ipv6 addresses. + */ + @JsonProperty(value = "ipv6Addresses", access = JsonProperty.Access.WRITE_ONLY) + private List ipv6Addresses; + + /* + * Gets or sets the nic MAC address. + */ + @JsonProperty(value = "macAddress") + private String macAddress; + + /* + * Gets or sets the ARM Id of the Microsoft.ScVmm/virtualNetwork resource + * to connect the nic. + */ + @JsonProperty(value = "virtualNetworkId") + private String virtualNetworkId; + + /* + * Gets or sets the name of the virtual network in vmmServer that the nic + * is connected to. + */ + @JsonProperty(value = "networkName", access = JsonProperty.Access.WRITE_ONLY) + private String networkName; + + /* + * Gets or sets the ipv4 address type. + */ + @JsonProperty(value = "ipv4AddressType") + private AllocationMethod ipv4AddressType; + + /* + * Gets or sets the ipv6 address type. + */ + @JsonProperty(value = "ipv6AddressType") + private AllocationMethod ipv6AddressType; + + /* + * Gets or sets the mac address type. + */ + @JsonProperty(value = "macAddressType") + private AllocationMethod macAddressType; + + /* + * Gets or sets the nic id. + */ + @JsonProperty(value = "nicId") + private String nicId; + + /** + * Get the name property: Gets or sets the name of the network interface. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets or sets the name of the network interface. + * + * @param name the name value to set. + * @return the NetworkInterfaces object itself. + */ + public NetworkInterfaces withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName property: Gets the display name of the network interface as shown in the vmmServer. This is + * the fallback label for a NIC when the name is not set. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the ipv4Addresses property: Gets or sets the nic ipv4 addresses. + * + * @return the ipv4Addresses value. + */ + public List ipv4Addresses() { + return this.ipv4Addresses; + } + + /** + * Get the ipv6Addresses property: Gets or sets the nic ipv6 addresses. + * + * @return the ipv6Addresses value. + */ + public List ipv6Addresses() { + return this.ipv6Addresses; + } + + /** + * Get the macAddress property: Gets or sets the nic MAC address. + * + * @return the macAddress value. + */ + public String macAddress() { + return this.macAddress; + } + + /** + * Set the macAddress property: Gets or sets the nic MAC address. + * + * @param macAddress the macAddress value to set. + * @return the NetworkInterfaces object itself. + */ + public NetworkInterfaces withMacAddress(String macAddress) { + this.macAddress = macAddress; + return this; + } + + /** + * Get the virtualNetworkId property: Gets or sets the ARM Id of the Microsoft.ScVmm/virtualNetwork resource to + * connect the nic. + * + * @return the virtualNetworkId value. + */ + public String virtualNetworkId() { + return this.virtualNetworkId; + } + + /** + * Set the virtualNetworkId property: Gets or sets the ARM Id of the Microsoft.ScVmm/virtualNetwork resource to + * connect the nic. + * + * @param virtualNetworkId the virtualNetworkId value to set. + * @return the NetworkInterfaces object itself. + */ + public NetworkInterfaces withVirtualNetworkId(String virtualNetworkId) { + this.virtualNetworkId = virtualNetworkId; + return this; + } + + /** + * Get the networkName property: Gets or sets the name of the virtual network in vmmServer that the nic is connected + * to. + * + * @return the networkName value. + */ + public String networkName() { + return this.networkName; + } + + /** + * Get the ipv4AddressType property: Gets or sets the ipv4 address type. + * + * @return the ipv4AddressType value. + */ + public AllocationMethod ipv4AddressType() { + return this.ipv4AddressType; + } + + /** + * Set the ipv4AddressType property: Gets or sets the ipv4 address type. + * + * @param ipv4AddressType the ipv4AddressType value to set. + * @return the NetworkInterfaces object itself. + */ + public NetworkInterfaces withIpv4AddressType(AllocationMethod ipv4AddressType) { + this.ipv4AddressType = ipv4AddressType; + return this; + } + + /** + * Get the ipv6AddressType property: Gets or sets the ipv6 address type. + * + * @return the ipv6AddressType value. + */ + public AllocationMethod ipv6AddressType() { + return this.ipv6AddressType; + } + + /** + * Set the ipv6AddressType property: Gets or sets the ipv6 address type. + * + * @param ipv6AddressType the ipv6AddressType value to set. + * @return the NetworkInterfaces object itself. + */ + public NetworkInterfaces withIpv6AddressType(AllocationMethod ipv6AddressType) { + this.ipv6AddressType = ipv6AddressType; + return this; + } + + /** + * Get the macAddressType property: Gets or sets the mac address type. + * + * @return the macAddressType value. + */ + public AllocationMethod macAddressType() { + return this.macAddressType; + } + + /** + * Set the macAddressType property: Gets or sets the mac address type. + * + * @param macAddressType the macAddressType value to set. + * @return the NetworkInterfaces object itself. + */ + public NetworkInterfaces withMacAddressType(AllocationMethod macAddressType) { + this.macAddressType = macAddressType; + return this; + } + + /** + * Get the nicId property: Gets or sets the nic id. + * + * @return the nicId value. + */ + public String nicId() { + return this.nicId; + } + + /** + * Set the nicId property: Gets or sets the nic id. + * + * @param nicId the nicId value to set. + * @return the NetworkInterfaces object itself. + */ + public NetworkInterfaces withNicId(String nicId) { + this.nicId = nicId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/NetworkInterfacesUpdate.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/NetworkInterfacesUpdate.java new file mode 100644 index 0000000000000..9da8cd4119ca2 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/NetworkInterfacesUpdate.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Network Interface model. */ +@Fluent +public final class NetworkInterfacesUpdate { + /* + * Gets or sets the name of the network interface. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Gets or sets the nic MAC address. + */ + @JsonProperty(value = "macAddress") + private String macAddress; + + /* + * Gets or sets the ARM Id of the Microsoft.ScVmm/virtualNetwork resource + * to connect the nic. + */ + @JsonProperty(value = "virtualNetworkId") + private String virtualNetworkId; + + /* + * Gets or sets the ipv4 address type. + */ + @JsonProperty(value = "ipv4AddressType") + private AllocationMethod ipv4AddressType; + + /* + * Gets or sets the ipv6 address type. + */ + @JsonProperty(value = "ipv6AddressType") + private AllocationMethod ipv6AddressType; + + /* + * Gets or sets the mac address type. + */ + @JsonProperty(value = "macAddressType") + private AllocationMethod macAddressType; + + /* + * Gets or sets the nic id. + */ + @JsonProperty(value = "nicId") + private String nicId; + + /** + * Get the name property: Gets or sets the name of the network interface. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets or sets the name of the network interface. + * + * @param name the name value to set. + * @return the NetworkInterfacesUpdate object itself. + */ + public NetworkInterfacesUpdate withName(String name) { + this.name = name; + return this; + } + + /** + * Get the macAddress property: Gets or sets the nic MAC address. + * + * @return the macAddress value. + */ + public String macAddress() { + return this.macAddress; + } + + /** + * Set the macAddress property: Gets or sets the nic MAC address. + * + * @param macAddress the macAddress value to set. + * @return the NetworkInterfacesUpdate object itself. + */ + public NetworkInterfacesUpdate withMacAddress(String macAddress) { + this.macAddress = macAddress; + return this; + } + + /** + * Get the virtualNetworkId property: Gets or sets the ARM Id of the Microsoft.ScVmm/virtualNetwork resource to + * connect the nic. + * + * @return the virtualNetworkId value. + */ + public String virtualNetworkId() { + return this.virtualNetworkId; + } + + /** + * Set the virtualNetworkId property: Gets or sets the ARM Id of the Microsoft.ScVmm/virtualNetwork resource to + * connect the nic. + * + * @param virtualNetworkId the virtualNetworkId value to set. + * @return the NetworkInterfacesUpdate object itself. + */ + public NetworkInterfacesUpdate withVirtualNetworkId(String virtualNetworkId) { + this.virtualNetworkId = virtualNetworkId; + return this; + } + + /** + * Get the ipv4AddressType property: Gets or sets the ipv4 address type. + * + * @return the ipv4AddressType value. + */ + public AllocationMethod ipv4AddressType() { + return this.ipv4AddressType; + } + + /** + * Set the ipv4AddressType property: Gets or sets the ipv4 address type. + * + * @param ipv4AddressType the ipv4AddressType value to set. + * @return the NetworkInterfacesUpdate object itself. + */ + public NetworkInterfacesUpdate withIpv4AddressType(AllocationMethod ipv4AddressType) { + this.ipv4AddressType = ipv4AddressType; + return this; + } + + /** + * Get the ipv6AddressType property: Gets or sets the ipv6 address type. + * + * @return the ipv6AddressType value. + */ + public AllocationMethod ipv6AddressType() { + return this.ipv6AddressType; + } + + /** + * Set the ipv6AddressType property: Gets or sets the ipv6 address type. + * + * @param ipv6AddressType the ipv6AddressType value to set. + * @return the NetworkInterfacesUpdate object itself. + */ + public NetworkInterfacesUpdate withIpv6AddressType(AllocationMethod ipv6AddressType) { + this.ipv6AddressType = ipv6AddressType; + return this; + } + + /** + * Get the macAddressType property: Gets or sets the mac address type. + * + * @return the macAddressType value. + */ + public AllocationMethod macAddressType() { + return this.macAddressType; + } + + /** + * Set the macAddressType property: Gets or sets the mac address type. + * + * @param macAddressType the macAddressType value to set. + * @return the NetworkInterfacesUpdate object itself. + */ + public NetworkInterfacesUpdate withMacAddressType(AllocationMethod macAddressType) { + this.macAddressType = macAddressType; + return this; + } + + /** + * Get the nicId property: Gets or sets the nic id. + * + * @return the nicId value. + */ + public String nicId() { + return this.nicId; + } + + /** + * Set the nicId property: Gets or sets the nic id. + * + * @param nicId the nicId value to set. + * @return the NetworkInterfacesUpdate object itself. + */ + public NetworkInterfacesUpdate withNicId(String nicId) { + this.nicId = nicId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/NetworkProfile.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/NetworkProfile.java new file mode 100644 index 0000000000000..236835c6891cc --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/NetworkProfile.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Defines the resource properties. */ +@Fluent +public final class NetworkProfile { + /* + * Gets or sets the list of network interfaces associated with the virtual + * machine. + */ + @JsonProperty(value = "networkInterfaces") + private List networkInterfaces; + + /** + * Get the networkInterfaces property: Gets or sets the list of network interfaces associated with the virtual + * machine. + * + * @return the networkInterfaces value. + */ + public List networkInterfaces() { + return this.networkInterfaces; + } + + /** + * Set the networkInterfaces property: Gets or sets the list of 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (networkInterfaces() != null) { + networkInterfaces().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/NetworkProfileUpdate.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/NetworkProfileUpdate.java new file mode 100644 index 0000000000000..a2f94cf4c0047 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/NetworkProfileUpdate.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Defines the resource properties. */ +@Fluent +public final class NetworkProfileUpdate { + /* + * Gets or sets the list of network interfaces associated with the virtual + * machine. + */ + @JsonProperty(value = "networkInterfaces") + private List networkInterfaces; + + /** + * Get the networkInterfaces property: Gets or sets the list of network interfaces associated with the virtual + * machine. + * + * @return the networkInterfaces value. + */ + public List networkInterfaces() { + return this.networkInterfaces; + } + + /** + * Set the networkInterfaces property: Gets or sets the list of network interfaces associated with the virtual + * machine. + * + * @param networkInterfaces the networkInterfaces value to set. + * @return the NetworkProfileUpdate object itself. + */ + public NetworkProfileUpdate withNetworkInterfaces(List networkInterfaces) { + this.networkInterfaces = networkInterfaces; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (networkInterfaces() != null) { + networkInterfaces().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/Operations.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/Operations.java new file mode 100644 index 0000000000000..a816f92d5bf00 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/Operations.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.scvmm.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Returns list of all operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list operations as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Returns list of all operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return results of the request to list operations as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/OsProfile.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/OsProfile.java new file mode 100644 index 0000000000000..3a78b8a4ce2db --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/OsProfile.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the resource properties. */ +@Fluent +public final class OsProfile { + /* + * Admin password of the virtual machine. + */ + @JsonProperty(value = "adminPassword") + private String adminPassword; + + /* + * Gets or sets computer name. + */ + @JsonProperty(value = "computerName") + private String computerName; + + /* + * Gets or sets the type of the os. + */ + @JsonProperty(value = "osType", access = JsonProperty.Access.WRITE_ONLY) + private OsType osType; + + /* + * Gets or sets os name. + */ + @JsonProperty(value = "osName", access = JsonProperty.Access.WRITE_ONLY) + private String osName; + + /** + * Get the adminPassword property: Admin password of the virtual machine. + * + * @return the adminPassword value. + */ + public String adminPassword() { + return this.adminPassword; + } + + /** + * Set the adminPassword property: Admin password of the virtual machine. + * + * @param adminPassword the adminPassword value to set. + * @return the OsProfile object itself. + */ + public OsProfile withAdminPassword(String adminPassword) { + this.adminPassword = adminPassword; + return this; + } + + /** + * Get the computerName property: Gets or sets computer name. + * + * @return the computerName value. + */ + public String computerName() { + return this.computerName; + } + + /** + * Set the computerName property: Gets or sets computer name. + * + * @param computerName the computerName value to set. + * @return the OsProfile object itself. + */ + public OsProfile withComputerName(String computerName) { + this.computerName = computerName; + return this; + } + + /** + * Get the osType property: Gets or sets the type of the os. + * + * @return the osType value. + */ + public OsType osType() { + return this.osType; + } + + /** + * Get the osName property: Gets or sets os name. + * + * @return the osName value. + */ + public String osName() { + return this.osName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/OsType.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/OsType.java new file mode 100644 index 0000000000000..d37bc3b3345ee --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/OsType.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.scvmm.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for OsType. */ +public final class OsType extends ExpandableStringEnum { + /** Static value Windows for OsType. */ + public static final OsType WINDOWS = fromString("Windows"); + + /** Static value Linux for OsType. */ + public static final OsType LINUX = fromString("Linux"); + + /** Static value Other for OsType. */ + public static final OsType OTHER = fromString("Other"); + + /** + * Creates or finds a OsType from its string representation. + * + * @param name a name to look for. + * @return the corresponding OsType. + */ + @JsonCreator + public static OsType fromString(String name) { + return fromString(name, OsType.class); + } + + /** @return known OsType values. */ + public static Collection values() { + return values(OsType.class); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/ResourcePatch.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/ResourcePatch.java new file mode 100644 index 0000000000000..7fcdbc35ddb94 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/ResourcePatch.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Object containing tags updates for patch operations. */ +@Fluent +public final class ResourcePatch { + /* + * 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 ResourcePatch object itself. + */ + public ResourcePatch 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/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/ResourceProviderOperation.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/ResourceProviderOperation.java new file mode 100644 index 0000000000000..fc49ed8d26042 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/ResourceProviderOperation.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.scvmm.models; + +import com.azure.resourcemanager.scvmm.fluent.models.ResourceProviderOperationInner; + +/** An immutable client-side representation of ResourceProviderOperation. */ +public interface ResourceProviderOperation { + /** + * Gets the isDataAction property: Indicates whether the operation applies to data-plane. + * + * @return the isDataAction value. + */ + String isDataAction(); + + /** + * Gets the name property: Operation name, in format of {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: Display metadata associated with the operation. + * + * @return the display value. + */ + ResourceProviderOperationDisplay display(); + + /** + * Gets the inner com.azure.resourcemanager.scvmm.fluent.models.ResourceProviderOperationInner object. + * + * @return the inner object. + */ + ResourceProviderOperationInner innerModel(); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/ResourceProviderOperationDisplay.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/ResourceProviderOperationDisplay.java new file mode 100644 index 0000000000000..92afd01048fde --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/ResourceProviderOperationDisplay.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Display metadata associated with the operation. */ +@Fluent +public final class ResourceProviderOperationDisplay { + /* + * The resource provider. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Resource on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Type of operation: read, write, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Description of this operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: The resource provider. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: The resource provider. + * + * @param provider the provider value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource on which the operation is performed. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource on which the operation is performed. + * + * @param resource the resource value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Type of operation: read, write, delete, etc. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Type of operation: read, write, delete, etc. + * + * @param operation the operation value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Description of this operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of this operation. + * + * @param description the description value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/ResourceProviderOperationList.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/ResourceProviderOperationList.java new file mode 100644 index 0000000000000..3b302688fa4da --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/ResourceProviderOperationList.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.scvmm.fluent.models.ResourceProviderOperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Results of the request to list operations. */ +@Fluent +public final class ResourceProviderOperationList { + /* + * List of Operations. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Url to follow for getting next page of resources. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of Operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of Operations. + * + * @param value the value value to set. + * @return the ResourceProviderOperationList object itself. + */ + public ResourceProviderOperationList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Url to follow for getting next page of resources. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to follow for getting next page of resources. + * + * @param nextLink the nextLink value to set. + * @return the ResourceProviderOperationList object itself. + */ + public ResourceProviderOperationList 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/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/StopVirtualMachineOptions.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/StopVirtualMachineOptions.java new file mode 100644 index 0000000000000..affdcb88ece27 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/StopVirtualMachineOptions.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the stop action properties. */ +@Fluent +public final class StopVirtualMachineOptions { + /* + * Gets or sets a value indicating whether to request non-graceful VM + * shutdown. True value for this flag indicates non-graceful shutdown + * whereas false indicates otherwise. Defaults to false. + */ + @JsonProperty(value = "skipShutdown") + private Boolean skipShutdown; + + /** + * Get the skipShutdown property: Gets or sets a value indicating whether to request non-graceful VM shutdown. True + * value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Defaults to false. + * + * @return the skipShutdown value. + */ + public Boolean skipShutdown() { + return this.skipShutdown; + } + + /** + * Set the skipShutdown property: Gets or sets a value indicating whether to request non-graceful VM shutdown. True + * value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Defaults to false. + * + * @param skipShutdown the skipShutdown value to set. + * @return the StopVirtualMachineOptions object itself. + */ + public StopVirtualMachineOptions withSkipShutdown(Boolean skipShutdown) { + this.skipShutdown = skipShutdown; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/StorageProfile.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/StorageProfile.java new file mode 100644 index 0000000000000..45a8e7d358932 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/StorageProfile.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Defines the resource properties. */ +@Fluent +public final class StorageProfile { + /* + * Gets or sets the list of virtual disks associated with the virtual + * machine. + */ + @JsonProperty(value = "disks") + private List disks; + + /** + * Get the disks property: Gets or sets the list of virtual disks associated with the virtual machine. + * + * @return the disks value. + */ + public List disks() { + return this.disks; + } + + /** + * Set the disks property: Gets or sets the list of virtual disks associated with the virtual machine. + * + * @param disks the disks value to set. + * @return the StorageProfile object itself. + */ + public StorageProfile withDisks(List disks) { + this.disks = disks; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (disks() != null) { + disks().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/StorageProfileUpdate.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/StorageProfileUpdate.java new file mode 100644 index 0000000000000..eff10b598a633 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/StorageProfileUpdate.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Defines the resource properties. */ +@Fluent +public final class StorageProfileUpdate { + /* + * Gets or sets the list of virtual disks associated with the virtual + * machine. + */ + @JsonProperty(value = "disks") + private List disks; + + /** + * Get the disks property: Gets or sets the list of virtual disks associated with the virtual machine. + * + * @return the disks value. + */ + public List disks() { + return this.disks; + } + + /** + * Set the disks property: Gets or sets the list of virtual disks associated with the virtual machine. + * + * @param disks the disks value to set. + * @return the StorageProfileUpdate object itself. + */ + public StorageProfileUpdate withDisks(List disks) { + this.disks = disks; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (disks() != null) { + disks().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/StorageQoSPolicy.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/StorageQoSPolicy.java new file mode 100644 index 0000000000000..8c7d571f6e8a2 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/StorageQoSPolicy.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The StorageQoSPolicy definition. */ +@Fluent +public final class StorageQoSPolicy { + /* + * The name of the policy. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The ID of the QoS policy. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The maximum IO operations per second. + */ + @JsonProperty(value = "iopsMaximum") + private Long iopsMaximum; + + /* + * The minimum IO operations per second. + */ + @JsonProperty(value = "iopsMinimum") + private Long iopsMinimum; + + /* + * The Bandwidth Limit for internet traffic. + */ + @JsonProperty(value = "bandwidthLimit") + private Long bandwidthLimit; + + /* + * The underlying policy. + */ + @JsonProperty(value = "policyId") + private String policyId; + + /** + * Get the name property: The name of the policy. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the policy. + * + * @param name the name value to set. + * @return the StorageQoSPolicy object itself. + */ + public StorageQoSPolicy withName(String name) { + this.name = name; + return this; + } + + /** + * Get the id property: The ID of the QoS policy. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The ID of the QoS policy. + * + * @param id the id value to set. + * @return the StorageQoSPolicy object itself. + */ + public StorageQoSPolicy withId(String id) { + this.id = id; + return this; + } + + /** + * Get the iopsMaximum property: The maximum IO operations per second. + * + * @return the iopsMaximum value. + */ + public Long iopsMaximum() { + return this.iopsMaximum; + } + + /** + * Set the iopsMaximum property: The maximum IO operations per second. + * + * @param iopsMaximum the iopsMaximum value to set. + * @return the StorageQoSPolicy object itself. + */ + public StorageQoSPolicy withIopsMaximum(Long iopsMaximum) { + this.iopsMaximum = iopsMaximum; + return this; + } + + /** + * Get the iopsMinimum property: The minimum IO operations per second. + * + * @return the iopsMinimum value. + */ + public Long iopsMinimum() { + return this.iopsMinimum; + } + + /** + * Set the iopsMinimum property: The minimum IO operations per second. + * + * @param iopsMinimum the iopsMinimum value to set. + * @return the StorageQoSPolicy object itself. + */ + public StorageQoSPolicy withIopsMinimum(Long iopsMinimum) { + this.iopsMinimum = iopsMinimum; + return this; + } + + /** + * Get the bandwidthLimit property: The Bandwidth Limit for internet traffic. + * + * @return the bandwidthLimit value. + */ + public Long bandwidthLimit() { + return this.bandwidthLimit; + } + + /** + * Set the bandwidthLimit property: The Bandwidth Limit for internet traffic. + * + * @param bandwidthLimit the bandwidthLimit value to set. + * @return the StorageQoSPolicy object itself. + */ + public StorageQoSPolicy withBandwidthLimit(Long bandwidthLimit) { + this.bandwidthLimit = bandwidthLimit; + return this; + } + + /** + * Get the policyId property: The underlying policy. + * + * @return the policyId value. + */ + public String policyId() { + return this.policyId; + } + + /** + * Set the policyId property: The underlying policy. + * + * @param policyId the policyId value to set. + * @return the StorageQoSPolicy object itself. + */ + public StorageQoSPolicy withPolicyId(String policyId) { + this.policyId = policyId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/StorageQoSPolicyDetails.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/StorageQoSPolicyDetails.java new file mode 100644 index 0000000000000..d7c9c264620e0 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/StorageQoSPolicyDetails.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The StorageQoSPolicyDetails definition. */ +@Fluent +public final class StorageQoSPolicyDetails { + /* + * The name of the policy. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The ID of the QoS policy. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the name property: The name of the policy. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the policy. + * + * @param name the name value to set. + * @return the StorageQoSPolicyDetails object itself. + */ + public StorageQoSPolicyDetails withName(String name) { + this.name = name; + return this; + } + + /** + * Get the id property: The ID of the QoS policy. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The ID of the QoS policy. + * + * @param id the id value to set. + * @return the StorageQoSPolicyDetails object itself. + */ + public StorageQoSPolicyDetails 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/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualDisk.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualDisk.java new file mode 100644 index 0000000000000..afc87f05ca68c --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualDisk.java @@ -0,0 +1,345 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Virtual disk model. */ +@Fluent +public final class VirtualDisk { + /* + * Gets or sets the name of the disk. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Gets the display name of the virtual disk as shown in the vmmServer. + * This is the fallback label for a disk when the name is not set. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * Gets or sets the disk id. + */ + @JsonProperty(value = "diskId") + private String diskId; + + /* + * Gets or sets the disk total size. + */ + @JsonProperty(value = "diskSizeGB") + private Integer diskSizeGB; + + /* + * Gets or sets the max disk size. + */ + @JsonProperty(value = "maxDiskSizeGB", access = JsonProperty.Access.WRITE_ONLY) + private Integer maxDiskSizeGB; + + /* + * Gets or sets the disk bus. + */ + @JsonProperty(value = "bus") + private Integer bus; + + /* + * Gets or sets the disk lun. + */ + @JsonProperty(value = "lun") + private Integer lun; + + /* + * Gets or sets the disk bus type. + */ + @JsonProperty(value = "busType") + private String busType; + + /* + * Gets or sets the disk vhd type. + */ + @JsonProperty(value = "vhdType") + private String vhdType; + + /* + * Gets or sets the disk volume type. + */ + @JsonProperty(value = "volumeType", access = JsonProperty.Access.WRITE_ONLY) + private String volumeType; + + /* + * Gets the disk vhd format type. + */ + @JsonProperty(value = "vhdFormatType", access = JsonProperty.Access.WRITE_ONLY) + private String vhdFormatType; + + /* + * Gets or sets the disk id in the template. + */ + @JsonProperty(value = "templateDiskId") + private String templateDiskId; + + /* + * The QoS policy for the disk. + */ + @JsonProperty(value = "storageQoSPolicy") + private StorageQoSPolicyDetails storageQoSPolicy; + + /* + * Gets or sets a value indicating diff disk. + */ + @JsonProperty(value = "createDiffDisk") + private CreateDiffDisk createDiffDisk; + + /** + * Get the name property: Gets or sets the name of the disk. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets or sets the name of the disk. + * + * @param name the name value to set. + * @return the VirtualDisk object itself. + */ + public VirtualDisk withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName property: Gets the display name of the virtual disk as shown in the vmmServer. This is the + * fallback label for a disk when the name is not set. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the diskId property: Gets or sets the disk id. + * + * @return the diskId value. + */ + public String diskId() { + return this.diskId; + } + + /** + * Set the diskId property: Gets or sets the disk id. + * + * @param diskId the diskId value to set. + * @return the VirtualDisk object itself. + */ + public VirtualDisk withDiskId(String diskId) { + this.diskId = diskId; + return this; + } + + /** + * Get the diskSizeGB property: Gets or sets the disk total size. + * + * @return the diskSizeGB value. + */ + public Integer diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB property: Gets or sets the disk total size. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the VirtualDisk object itself. + */ + public VirtualDisk withDiskSizeGB(Integer diskSizeGB) { + this.diskSizeGB = diskSizeGB; + return this; + } + + /** + * Get the maxDiskSizeGB property: Gets or sets the max disk size. + * + * @return the maxDiskSizeGB value. + */ + public Integer maxDiskSizeGB() { + return this.maxDiskSizeGB; + } + + /** + * Get the bus property: Gets or sets the disk bus. + * + * @return the bus value. + */ + public Integer bus() { + return this.bus; + } + + /** + * Set the bus property: Gets or sets the disk bus. + * + * @param bus the bus value to set. + * @return the VirtualDisk object itself. + */ + public VirtualDisk withBus(Integer bus) { + this.bus = bus; + return this; + } + + /** + * Get the lun property: Gets or sets the disk lun. + * + * @return the lun value. + */ + public Integer lun() { + return this.lun; + } + + /** + * Set the lun property: Gets or sets the disk lun. + * + * @param lun the lun value to set. + * @return the VirtualDisk object itself. + */ + public VirtualDisk withLun(Integer lun) { + this.lun = lun; + return this; + } + + /** + * Get the busType property: Gets or sets the disk bus type. + * + * @return the busType value. + */ + public String busType() { + return this.busType; + } + + /** + * Set the busType property: Gets or sets the disk bus type. + * + * @param busType the busType value to set. + * @return the VirtualDisk object itself. + */ + public VirtualDisk withBusType(String busType) { + this.busType = busType; + return this; + } + + /** + * Get the vhdType property: Gets or sets the disk vhd type. + * + * @return the vhdType value. + */ + public String vhdType() { + return this.vhdType; + } + + /** + * Set the vhdType property: Gets or sets the disk vhd type. + * + * @param vhdType the vhdType value to set. + * @return the VirtualDisk object itself. + */ + public VirtualDisk withVhdType(String vhdType) { + this.vhdType = vhdType; + return this; + } + + /** + * Get the volumeType property: Gets or sets the disk volume type. + * + * @return the volumeType value. + */ + public String volumeType() { + return this.volumeType; + } + + /** + * Get the vhdFormatType property: Gets the disk vhd format type. + * + * @return the vhdFormatType value. + */ + public String vhdFormatType() { + return this.vhdFormatType; + } + + /** + * Get the templateDiskId property: Gets or sets the disk id in the template. + * + * @return the templateDiskId value. + */ + public String templateDiskId() { + return this.templateDiskId; + } + + /** + * Set the templateDiskId property: Gets or sets the disk id in the template. + * + * @param templateDiskId the templateDiskId value to set. + * @return the VirtualDisk object itself. + */ + public VirtualDisk withTemplateDiskId(String templateDiskId) { + this.templateDiskId = templateDiskId; + return this; + } + + /** + * Get the storageQoSPolicy property: The QoS policy for the disk. + * + * @return the storageQoSPolicy value. + */ + public StorageQoSPolicyDetails storageQoSPolicy() { + return this.storageQoSPolicy; + } + + /** + * Set the storageQoSPolicy property: The QoS policy for the disk. + * + * @param storageQoSPolicy the storageQoSPolicy value to set. + * @return the VirtualDisk object itself. + */ + public VirtualDisk withStorageQoSPolicy(StorageQoSPolicyDetails storageQoSPolicy) { + this.storageQoSPolicy = storageQoSPolicy; + return this; + } + + /** + * Get the createDiffDisk property: Gets or sets a value indicating diff disk. + * + * @return the createDiffDisk value. + */ + public CreateDiffDisk createDiffDisk() { + return this.createDiffDisk; + } + + /** + * Set the createDiffDisk property: Gets or sets a value indicating diff disk. + * + * @param createDiffDisk the createDiffDisk value to set. + * @return the VirtualDisk object itself. + */ + public VirtualDisk withCreateDiffDisk(CreateDiffDisk createDiffDisk) { + this.createDiffDisk = createDiffDisk; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageQoSPolicy() != null) { + storageQoSPolicy().validate(); + } + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualDiskUpdate.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualDiskUpdate.java new file mode 100644 index 0000000000000..7fa03f42a269f --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualDiskUpdate.java @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Virtual disk model. */ +@Fluent +public final class VirtualDiskUpdate { + /* + * Gets or sets the name of the disk. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Gets or sets the disk id. + */ + @JsonProperty(value = "diskId") + private String diskId; + + /* + * Gets or sets the disk total size. + */ + @JsonProperty(value = "diskSizeGB") + private Integer diskSizeGB; + + /* + * Gets or sets the disk bus. + */ + @JsonProperty(value = "bus") + private Integer bus; + + /* + * Gets or sets the disk lun. + */ + @JsonProperty(value = "lun") + private Integer lun; + + /* + * Gets or sets the disk bus type. + */ + @JsonProperty(value = "busType") + private String busType; + + /* + * Gets or sets the disk vhd type. + */ + @JsonProperty(value = "vhdType") + private String vhdType; + + /* + * The QoS policy for the disk. + */ + @JsonProperty(value = "storageQoSPolicy") + private StorageQoSPolicyDetails storageQoSPolicy; + + /** + * Get the name property: Gets or sets the name of the disk. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets or sets the name of the disk. + * + * @param name the name value to set. + * @return the VirtualDiskUpdate object itself. + */ + public VirtualDiskUpdate withName(String name) { + this.name = name; + return this; + } + + /** + * Get the diskId property: Gets or sets the disk id. + * + * @return the diskId value. + */ + public String diskId() { + return this.diskId; + } + + /** + * Set the diskId property: Gets or sets the disk id. + * + * @param diskId the diskId value to set. + * @return the VirtualDiskUpdate object itself. + */ + public VirtualDiskUpdate withDiskId(String diskId) { + this.diskId = diskId; + return this; + } + + /** + * Get the diskSizeGB property: Gets or sets the disk total size. + * + * @return the diskSizeGB value. + */ + public Integer diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB property: Gets or sets the disk total size. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the VirtualDiskUpdate object itself. + */ + public VirtualDiskUpdate withDiskSizeGB(Integer diskSizeGB) { + this.diskSizeGB = diskSizeGB; + return this; + } + + /** + * Get the bus property: Gets or sets the disk bus. + * + * @return the bus value. + */ + public Integer bus() { + return this.bus; + } + + /** + * Set the bus property: Gets or sets the disk bus. + * + * @param bus the bus value to set. + * @return the VirtualDiskUpdate object itself. + */ + public VirtualDiskUpdate withBus(Integer bus) { + this.bus = bus; + return this; + } + + /** + * Get the lun property: Gets or sets the disk lun. + * + * @return the lun value. + */ + public Integer lun() { + return this.lun; + } + + /** + * Set the lun property: Gets or sets the disk lun. + * + * @param lun the lun value to set. + * @return the VirtualDiskUpdate object itself. + */ + public VirtualDiskUpdate withLun(Integer lun) { + this.lun = lun; + return this; + } + + /** + * Get the busType property: Gets or sets the disk bus type. + * + * @return the busType value. + */ + public String busType() { + return this.busType; + } + + /** + * Set the busType property: Gets or sets the disk bus type. + * + * @param busType the busType value to set. + * @return the VirtualDiskUpdate object itself. + */ + public VirtualDiskUpdate withBusType(String busType) { + this.busType = busType; + return this; + } + + /** + * Get the vhdType property: Gets or sets the disk vhd type. + * + * @return the vhdType value. + */ + public String vhdType() { + return this.vhdType; + } + + /** + * Set the vhdType property: Gets or sets the disk vhd type. + * + * @param vhdType the vhdType value to set. + * @return the VirtualDiskUpdate object itself. + */ + public VirtualDiskUpdate withVhdType(String vhdType) { + this.vhdType = vhdType; + return this; + } + + /** + * Get the storageQoSPolicy property: The QoS policy for the disk. + * + * @return the storageQoSPolicy value. + */ + public StorageQoSPolicyDetails storageQoSPolicy() { + return this.storageQoSPolicy; + } + + /** + * Set the storageQoSPolicy property: The QoS policy for the disk. + * + * @param storageQoSPolicy the storageQoSPolicy value to set. + * @return the VirtualDiskUpdate object itself. + */ + public VirtualDiskUpdate withStorageQoSPolicy(StorageQoSPolicyDetails storageQoSPolicy) { + this.storageQoSPolicy = storageQoSPolicy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageQoSPolicy() != null) { + storageQoSPolicy().validate(); + } + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachine.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachine.java new file mode 100644 index 0000000000000..08cfcafeff06e --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachine.java @@ -0,0 +1,648 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.fluent.models.VirtualMachineInner; +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 systemData property: The system data. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the extendedLocation property: The extended location. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @return the inventoryItemId value. + */ + String inventoryItemId(); + + /** + * Gets the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @return the vmmServerId value. + */ + String vmmServerId(); + + /** + * Gets the cloudId property: ARM Id of the cloud resource to use for deploying the vm. + * + * @return the cloudId value. + */ + String cloudId(); + + /** + * Gets the templateId property: ARM Id of the template resource to use for deploying the vm. + * + * @return the templateId value. + */ + String templateId(); + + /** + * Gets the checkpointType property: Type of checkpoint supported for the vm. + * + * @return the checkpointType value. + */ + String checkpointType(); + + /** + * Gets the checkpoints property: Checkpoints in the vm. + * + * @return the checkpoints value. + */ + List checkpoints(); + + /** + * Gets the availabilitySets property: Availability Sets in vm. + * + * @return the availabilitySets value. + */ + List availabilitySets(); + + /** + * Gets the osProfile property: OS properties. + * + * @return the osProfile value. + */ + OsProfile osProfile(); + + /** + * Gets the hardwareProfile property: Hardware properties. + * + * @return the hardwareProfile value. + */ + HardwareProfile hardwareProfile(); + + /** + * Gets the networkProfile property: Network properties. + * + * @return the networkProfile value. + */ + NetworkProfile networkProfile(); + + /** + * Gets the storageProfile property: Storage properties. + * + * @return the storageProfile value. + */ + StorageProfile storageProfile(); + + /** + * Gets the vmName property: VMName is the name of VM on the SCVMM server. + * + * @return the vmName value. + */ + String vmName(); + + /** + * Gets the uuid property: Unique ID of the virtual machine. + * + * @return the uuid value. + */ + String uuid(); + + /** + * Gets the generation property: Gets or sets the generation for the vm. + * + * @return the generation value. + */ + Integer generation(); + + /** + * Gets the powerState property: Gets the power state of the virtual machine. + * + * @return the powerState value. + */ + String powerState(); + + /** + * Gets the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.scvmm.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.WithExtendedLocation, + 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. + */ + WithExtendedLocation withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the VirtualMachine definition allowing to specify extendedLocation. */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extended location.. + * + * @param extendedLocation The extended location. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + /** + * 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.WithInventoryItemId, + DefinitionStages.WithVmmServerId, + DefinitionStages.WithCloudId, + DefinitionStages.WithTemplateId, + DefinitionStages.WithCheckpointType, + DefinitionStages.WithCheckpoints, + DefinitionStages.WithAvailabilitySets, + DefinitionStages.WithOsProfile, + DefinitionStages.WithHardwareProfile, + DefinitionStages.WithNetworkProfile, + DefinitionStages.WithStorageProfile, + DefinitionStages.WithVmName, + DefinitionStages.WithUuid, + DefinitionStages.WithGeneration { + /** + * 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 inventoryItemId. */ + interface WithInventoryItemId { + /** + * Specifies the inventoryItemId property: Gets or sets the inventory Item ID for the resource.. + * + * @param inventoryItemId Gets or sets the inventory Item ID for the resource. + * @return the next definition stage. + */ + WithCreate withInventoryItemId(String inventoryItemId); + } + /** The stage of the VirtualMachine definition allowing to specify vmmServerId. */ + interface WithVmmServerId { + /** + * Specifies the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides.. + * + * @param vmmServerId ARM Id of the vmmServer resource in which this resource resides. + * @return the next definition stage. + */ + WithCreate withVmmServerId(String vmmServerId); + } + /** The stage of the VirtualMachine definition allowing to specify cloudId. */ + interface WithCloudId { + /** + * Specifies the cloudId property: ARM Id of the cloud resource to use for deploying the vm.. + * + * @param cloudId ARM Id of the cloud resource to use for deploying the vm. + * @return the next definition stage. + */ + WithCreate withCloudId(String cloudId); + } + /** The stage of the VirtualMachine definition allowing to specify templateId. */ + interface WithTemplateId { + /** + * Specifies the templateId property: ARM Id of the template resource to use for deploying the vm.. + * + * @param templateId ARM Id of the template resource to use for deploying the vm. + * @return the next definition stage. + */ + WithCreate withTemplateId(String templateId); + } + /** The stage of the VirtualMachine definition allowing to specify checkpointType. */ + interface WithCheckpointType { + /** + * Specifies the checkpointType property: Type of checkpoint supported for the vm.. + * + * @param checkpointType Type of checkpoint supported for the vm. + * @return the next definition stage. + */ + WithCreate withCheckpointType(String checkpointType); + } + /** The stage of the VirtualMachine definition allowing to specify checkpoints. */ + interface WithCheckpoints { + /** + * Specifies the checkpoints property: Checkpoints in the vm.. + * + * @param checkpoints Checkpoints in the vm. + * @return the next definition stage. + */ + WithCreate withCheckpoints(List checkpoints); + } + /** The stage of the VirtualMachine definition allowing to specify availabilitySets. */ + interface WithAvailabilitySets { + /** + * Specifies the availabilitySets property: Availability Sets in vm.. + * + * @param availabilitySets Availability Sets in vm. + * @return the next definition stage. + */ + WithCreate withAvailabilitySets(List availabilitySets); + } + /** The stage of the VirtualMachine definition allowing to specify osProfile. */ + interface WithOsProfile { + /** + * Specifies the osProfile property: OS properties.. + * + * @param osProfile OS properties. + * @return the next definition stage. + */ + WithCreate withOsProfile(OsProfile osProfile); + } + /** The stage of the VirtualMachine definition allowing to specify hardwareProfile. */ + interface WithHardwareProfile { + /** + * Specifies the hardwareProfile property: Hardware properties.. + * + * @param hardwareProfile Hardware properties. + * @return the next definition stage. + */ + WithCreate withHardwareProfile(HardwareProfile hardwareProfile); + } + /** The stage of the VirtualMachine definition allowing to specify networkProfile. */ + interface WithNetworkProfile { + /** + * Specifies the networkProfile property: Network properties.. + * + * @param networkProfile Network properties. + * @return the next definition stage. + */ + WithCreate withNetworkProfile(NetworkProfile networkProfile); + } + /** The stage of the VirtualMachine definition allowing to specify storageProfile. */ + interface WithStorageProfile { + /** + * Specifies the storageProfile property: Storage properties.. + * + * @param storageProfile Storage properties. + * @return the next definition stage. + */ + WithCreate withStorageProfile(StorageProfile storageProfile); + } + /** The stage of the VirtualMachine definition allowing to specify vmName. */ + interface WithVmName { + /** + * Specifies the vmName property: VMName is the name of VM on the SCVMM server.. + * + * @param vmName VMName is the name of VM on the SCVMM server. + * @return the next definition stage. + */ + WithCreate withVmName(String vmName); + } + /** The stage of the VirtualMachine definition allowing to specify uuid. */ + interface WithUuid { + /** + * Specifies the uuid property: Unique ID of the virtual machine.. + * + * @param uuid Unique ID of the virtual machine. + * @return the next definition stage. + */ + WithCreate withUuid(String uuid); + } + /** The stage of the VirtualMachine definition allowing to specify generation. */ + interface WithGeneration { + /** + * Specifies the generation property: Gets or sets the generation for the vm.. + * + * @param generation Gets or sets the generation for the vm. + * @return the next definition stage. + */ + WithCreate withGeneration(Integer generation); + } + } + /** + * 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.WithProperties { + /** + * 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: Gets or sets the Resource tags.. + * + * @param tags Gets or sets the Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the VirtualMachine update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Defines the resource properties.. + * + * @param properties Defines the resource properties. + * @return the next definition stage. + */ + Update withProperties(VirtualMachineUpdateProperties properties); + } + } + /** + * 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); + + /** + * Stop virtual machine. + * + * @param body Virtualmachine stop action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stop(StopVirtualMachineOptions body); + + /** + * Stop virtual machine. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stop(); + + /** + * Stop virtual machine. + * + * @param body Virtualmachine stop action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stop(StopVirtualMachineOptions body, Context context); + + /** + * Start virtual machine. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(); + + /** + * Start virtual machine. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(Context context); + + /** + * Restart virtual machine. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(); + + /** + * Restart virtual machine. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(Context context); + + /** + * Creates a checkpoint in virtual machine. + * + * @param body Virtualmachine create checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 createCheckpoint(VirtualMachineCreateCheckpoint body); + + /** + * Creates a checkpoint in virtual machine. + * + * @throws com.azure.core.management.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 createCheckpoint(); + + /** + * Creates a checkpoint in virtual machine. + * + * @param body Virtualmachine create checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 createCheckpoint(VirtualMachineCreateCheckpoint body, Context context); + + /** + * Deletes a checkpoint in virtual machine. + * + * @param body Virtualmachine delete checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 deleteCheckpoint(VirtualMachineDeleteCheckpoint body); + + /** + * Deletes a checkpoint in virtual machine. + * + * @throws com.azure.core.management.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 deleteCheckpoint(); + + /** + * Deletes a checkpoint in virtual machine. + * + * @param body Virtualmachine delete checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 deleteCheckpoint(VirtualMachineDeleteCheckpoint body, Context context); + + /** + * Restores to a checkpoint in virtual machine. + * + * @param body Virtualmachine restore checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 restoreCheckpoint(VirtualMachineRestoreCheckpoint body); + + /** + * Restores to a checkpoint in virtual machine. + * + * @throws com.azure.core.management.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 restoreCheckpoint(); + + /** + * Restores to a checkpoint in virtual machine. + * + * @param body Virtualmachine restore checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 restoreCheckpoint(VirtualMachineRestoreCheckpoint body, Context context); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineCreateCheckpoint.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineCreateCheckpoint.java new file mode 100644 index 0000000000000..86483c0ffe117 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineCreateCheckpoint.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the create checkpoint action properties. */ +@Fluent +public final class VirtualMachineCreateCheckpoint { + /* + * Name of the checkpoint. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Description of the checkpoint. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the name property: Name of the checkpoint. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the checkpoint. + * + * @param name the name value to set. + * @return the VirtualMachineCreateCheckpoint object itself. + */ + public VirtualMachineCreateCheckpoint withName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: Description of the checkpoint. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the checkpoint. + * + * @param description the description value to set. + * @return the VirtualMachineCreateCheckpoint object itself. + */ + public VirtualMachineCreateCheckpoint withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineDeleteCheckpoint.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineDeleteCheckpoint.java new file mode 100644 index 0000000000000..ba1c5c65157c6 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineDeleteCheckpoint.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the delete checkpoint action properties. */ +@Fluent +public final class VirtualMachineDeleteCheckpoint { + /* + * ID of the checkpoint to be deleted. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the id property: ID of the checkpoint to be deleted. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: ID of the checkpoint to be deleted. + * + * @param id the id value to set. + * @return the VirtualMachineDeleteCheckpoint object itself. + */ + public VirtualMachineDeleteCheckpoint 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/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineInventoryItem.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineInventoryItem.java new file mode 100644 index 0000000000000..b59eabfceb9cf --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineInventoryItem.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.scvmm.fluent.models.InventoryItemProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** The Virtual machine inventory item. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "inventoryType") +@JsonTypeName("VirtualMachine") +@Fluent +public final class VirtualMachineInventoryItem extends InventoryItemProperties { + /* + * Gets or sets the type of the os. + */ + @JsonProperty(value = "osType", access = JsonProperty.Access.WRITE_ONLY) + private OsType osType; + + /* + * Gets or sets os name. + */ + @JsonProperty(value = "osName", access = JsonProperty.Access.WRITE_ONLY) + private String osName; + + /* + * Gets the power state of the virtual machine. + */ + @JsonProperty(value = "powerState", access = JsonProperty.Access.WRITE_ONLY) + private String powerState; + + /* + * Gets or sets the nic ip addresses. + */ + @JsonProperty(value = "ipAddresses") + private List ipAddresses; + + /* + * Cloud inventory resource details where the VM is present. + */ + @JsonProperty(value = "cloud") + private InventoryItemDetails cloud; + + /** + * Get the osType property: Gets or sets the type of the os. + * + * @return the osType value. + */ + public OsType osType() { + return this.osType; + } + + /** + * Get the osName property: Gets or sets os name. + * + * @return the osName value. + */ + public String osName() { + return this.osName; + } + + /** + * Get the powerState property: Gets the power state of the virtual machine. + * + * @return the powerState value. + */ + public String powerState() { + return this.powerState; + } + + /** + * Get the ipAddresses property: Gets or sets the nic ip addresses. + * + * @return the ipAddresses value. + */ + public List ipAddresses() { + return this.ipAddresses; + } + + /** + * Set the ipAddresses property: Gets or sets the nic ip addresses. + * + * @param ipAddresses the ipAddresses value to set. + * @return the VirtualMachineInventoryItem object itself. + */ + public VirtualMachineInventoryItem withIpAddresses(List ipAddresses) { + this.ipAddresses = ipAddresses; + return this; + } + + /** + * Get the cloud property: Cloud inventory resource details where the VM is present. + * + * @return the cloud value. + */ + public InventoryItemDetails cloud() { + return this.cloud; + } + + /** + * Set the cloud property: Cloud inventory resource details where the VM is present. + * + * @param cloud the cloud value to set. + * @return the VirtualMachineInventoryItem object itself. + */ + public VirtualMachineInventoryItem withCloud(InventoryItemDetails cloud) { + this.cloud = cloud; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (cloud() != null) { + cloud().validate(); + } + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineListResult.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineListResult.java new file mode 100644 index 0000000000000..bd89734b3c359 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineListResult.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.scvmm.fluent.models.VirtualMachineInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of VirtualMachines. */ +@Fluent +public final class VirtualMachineListResult { + /* + * List of VirtualMachines. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Url to follow for getting next page of resources. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of VirtualMachines. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of VirtualMachines. + * + * @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: Url to follow for getting next page of resources. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to follow for getting next page of resources. + * + * @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) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineRestoreCheckpoint.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineRestoreCheckpoint.java new file mode 100644 index 0000000000000..0c83860fc5f15 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineRestoreCheckpoint.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the restore checkpoint action properties. */ +@Fluent +public final class VirtualMachineRestoreCheckpoint { + /* + * ID of the checkpoint to be restored to. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the id property: ID of the checkpoint to be restored to. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: ID of the checkpoint to be restored to. + * + * @param id the id value to set. + * @return the VirtualMachineRestoreCheckpoint object itself. + */ + public VirtualMachineRestoreCheckpoint 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/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineTemplate.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineTemplate.java new file mode 100644 index 0000000000000..ec640c396a1e5 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineTemplate.java @@ -0,0 +1,380 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.fluent.models.VirtualMachineTemplateInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of VirtualMachineTemplate. */ +public interface VirtualMachineTemplate { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: The system data. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the extendedLocation property: The extended location. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @return the inventoryItemId value. + */ + String inventoryItemId(); + + /** + * Gets the uuid property: Unique ID of the virtual machine template. + * + * @return the uuid value. + */ + String uuid(); + + /** + * Gets the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @return the vmmServerId value. + */ + String vmmServerId(); + + /** + * Gets the osType property: Gets or sets the type of the os. + * + * @return the osType value. + */ + OsType osType(); + + /** + * Gets the osName property: Gets or sets os name. + * + * @return the osName value. + */ + String osName(); + + /** + * Gets the computerName property: Gets or sets computer name. + * + * @return the computerName value. + */ + String computerName(); + + /** + * Gets the memoryMB property: MemoryMB is the desired size of a virtual machine's memory, in MB. + * + * @return the memoryMB value. + */ + Integer memoryMB(); + + /** + * Gets the cpuCount property: Gets or sets the desired number of vCPUs for the vm. + * + * @return the cpuCount value. + */ + Integer cpuCount(); + + /** + * Gets the limitCpuForMigration property: Gets or sets a value indicating whether to enable processor compatibility + * mode for live migration of VMs. + * + * @return the limitCpuForMigration value. + */ + LimitCpuForMigration limitCpuForMigration(); + + /** + * Gets the dynamicMemoryEnabled property: Gets or sets a value indicating whether to enable dynamic memory or not. + * + * @return the dynamicMemoryEnabled value. + */ + DynamicMemoryEnabled dynamicMemoryEnabled(); + + /** + * Gets the isCustomizable property: Gets or sets a value indicating whether the vm template is customizable or not. + * + * @return the isCustomizable value. + */ + IsCustomizable isCustomizable(); + + /** + * Gets the dynamicMemoryMaxMB property: Gets or sets the max dynamic memory for the vm. + * + * @return the dynamicMemoryMaxMB value. + */ + Integer dynamicMemoryMaxMB(); + + /** + * Gets the dynamicMemoryMinMB property: Gets or sets the min dynamic memory for the vm. + * + * @return the dynamicMemoryMinMB value. + */ + Integer dynamicMemoryMinMB(); + + /** + * Gets the isHighlyAvailable property: Gets highly available property. + * + * @return the isHighlyAvailable value. + */ + String isHighlyAvailable(); + + /** + * Gets the generation property: Gets or sets the generation for the vm. + * + * @return the generation value. + */ + Integer generation(); + + /** + * Gets the networkInterfaces property: Gets or sets the network interfaces of the template. + * + * @return the networkInterfaces value. + */ + List networkInterfaces(); + + /** + * Gets the disks property: Gets or sets the disks of the template. + * + * @return the disks value. + */ + List disks(); + + /** + * Gets the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.scvmm.fluent.models.VirtualMachineTemplateInner object. + * + * @return the inner object. + */ + VirtualMachineTemplateInner innerModel(); + + /** The entirety of the VirtualMachineTemplate definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithExtendedLocation, + DefinitionStages.WithCreate { + } + /** The VirtualMachineTemplate definition stages. */ + interface DefinitionStages { + /** The first stage of the VirtualMachineTemplate definition. */ + interface Blank extends WithLocation { + } + /** The stage of the VirtualMachineTemplate 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 VirtualMachineTemplate definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithExtendedLocation withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the VirtualMachineTemplate definition allowing to specify extendedLocation. */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extended location.. + * + * @param extendedLocation The extended location. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + /** + * The stage of the VirtualMachineTemplate 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.WithInventoryItemId, + DefinitionStages.WithUuid, + DefinitionStages.WithVmmServerId { + /** + * Executes the create request. + * + * @return the created resource. + */ + VirtualMachineTemplate create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + VirtualMachineTemplate create(Context context); + } + /** The stage of the VirtualMachineTemplate 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 VirtualMachineTemplate definition allowing to specify inventoryItemId. */ + interface WithInventoryItemId { + /** + * Specifies the inventoryItemId property: Gets or sets the inventory Item ID for the resource.. + * + * @param inventoryItemId Gets or sets the inventory Item ID for the resource. + * @return the next definition stage. + */ + WithCreate withInventoryItemId(String inventoryItemId); + } + /** The stage of the VirtualMachineTemplate definition allowing to specify uuid. */ + interface WithUuid { + /** + * Specifies the uuid property: Unique ID of the virtual machine template.. + * + * @param uuid Unique ID of the virtual machine template. + * @return the next definition stage. + */ + WithCreate withUuid(String uuid); + } + /** The stage of the VirtualMachineTemplate definition allowing to specify vmmServerId. */ + interface WithVmmServerId { + /** + * Specifies the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides.. + * + * @param vmmServerId ARM Id of the vmmServer resource in which this resource resides. + * @return the next definition stage. + */ + WithCreate withVmmServerId(String vmmServerId); + } + } + /** + * Begins update for the VirtualMachineTemplate resource. + * + * @return the stage of resource update. + */ + VirtualMachineTemplate.Update update(); + + /** The template for VirtualMachineTemplate update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + VirtualMachineTemplate apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + VirtualMachineTemplate apply(Context context); + } + /** The VirtualMachineTemplate update stages. */ + interface UpdateStages { + /** The stage of the VirtualMachineTemplate 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. + */ + VirtualMachineTemplate refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + VirtualMachineTemplate refresh(Context context); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineTemplateInventoryItem.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineTemplateInventoryItem.java new file mode 100644 index 0000000000000..f0691296e4779 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineTemplateInventoryItem.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.scvmm.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.scvmm.fluent.models.InventoryItemProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The Virtual machine template inventory item. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "inventoryType") +@JsonTypeName("VirtualMachineTemplate") +@Immutable +public final class VirtualMachineTemplateInventoryItem extends InventoryItemProperties { + /* + * Gets or sets the desired number of vCPUs for the vm. + */ + @JsonProperty(value = "cpuCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer cpuCount; + + /* + * MemoryMB is the desired size of a virtual machine's memory, in MB. + */ + @JsonProperty(value = "memoryMB", access = JsonProperty.Access.WRITE_ONLY) + private Integer memoryMB; + + /* + * Gets or sets the type of the os. + */ + @JsonProperty(value = "osType", access = JsonProperty.Access.WRITE_ONLY) + private OsType osType; + + /* + * Gets or sets os name. + */ + @JsonProperty(value = "osName", access = JsonProperty.Access.WRITE_ONLY) + private String osName; + + /** + * Get the cpuCount property: Gets or sets the desired number of vCPUs for the vm. + * + * @return the cpuCount value. + */ + public Integer cpuCount() { + return this.cpuCount; + } + + /** + * Get the memoryMB property: MemoryMB is the desired size of a virtual machine's memory, in MB. + * + * @return the memoryMB value. + */ + public Integer memoryMB() { + return this.memoryMB; + } + + /** + * Get the osType property: Gets or sets the type of the os. + * + * @return the osType value. + */ + public OsType osType() { + return this.osType; + } + + /** + * Get the osName property: Gets or sets os name. + * + * @return the osName value. + */ + public String osName() { + return this.osName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineTemplateListResult.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineTemplateListResult.java new file mode 100644 index 0000000000000..898bc94a55669 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineTemplateListResult.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.scvmm.fluent.models.VirtualMachineTemplateInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of VirtualMachineTemplates. */ +@Fluent +public final class VirtualMachineTemplateListResult { + /* + * List of VirtualMachineTemplates. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Url to follow for getting next page of resources. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of VirtualMachineTemplates. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of VirtualMachineTemplates. + * + * @param value the value value to set. + * @return the VirtualMachineTemplateListResult object itself. + */ + public VirtualMachineTemplateListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Url to follow for getting next page of resources. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to follow for getting next page of resources. + * + * @param nextLink the nextLink value to set. + * @return the VirtualMachineTemplateListResult object itself. + */ + public VirtualMachineTemplateListResult 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/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineTemplates.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineTemplates.java new file mode 100644 index 0000000000000..11730fef48994 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineTemplates.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.scvmm.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 VirtualMachineTemplates. */ +public interface VirtualMachineTemplates { + /** + * Implements VirtualMachineTemplate GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition. + */ + VirtualMachineTemplate getByResourceGroup(String resourceGroupName, String virtualMachineTemplateName); + + /** + * Implements VirtualMachineTemplate GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualMachineTemplateName, Context context); + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualMachineTemplateName, Boolean force); + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualMachineTemplateName); + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineTemplateName Name of the VirtualMachineTemplate. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualMachineTemplateName, Boolean force, Context context); + + /** + * List of VirtualMachineTemplates in 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 list of VirtualMachineTemplates as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of VirtualMachineTemplates 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.core.management.exception.ManagementException 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 VirtualMachineTemplates as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List of VirtualMachineTemplates in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualMachineTemplates as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List of VirtualMachineTemplates in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualMachineTemplates as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Implements VirtualMachineTemplate GET method. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition along with {@link Response}. + */ + VirtualMachineTemplate getById(String id); + + /** + * Implements VirtualMachineTemplate GET method. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachineTemplates resource definition along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @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); + + /** + * Deregisters the ScVmm VM Template from Azure. + * + * @param id the resource ID. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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, Boolean force, Context context); + + /** + * Begins definition for a new VirtualMachineTemplate resource. + * + * @param name resource name. + * @return the first stage of the new VirtualMachineTemplate definition. + */ + VirtualMachineTemplate.DefinitionStages.Blank define(String name); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineUpdate.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineUpdate.java new file mode 100644 index 0000000000000..c2772364c22f7 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineUpdate.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Defines the virtualMachineUpdate. */ +@Fluent +public final class VirtualMachineUpdate { + /* + * Defines the resource properties. + */ + @JsonProperty(value = "properties") + private VirtualMachineUpdateProperties properties; + + /* + * Gets or sets the Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the properties property: Defines the resource properties. + * + * @return the properties value. + */ + public VirtualMachineUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Defines the resource properties. + * + * @param properties the properties value to set. + * @return the VirtualMachineUpdate object itself. + */ + public VirtualMachineUpdate withProperties(VirtualMachineUpdateProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the tags property: Gets or sets the Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Gets or sets the Resource tags. + * + * @param tags the tags value to set. + * @return the VirtualMachineUpdate object itself. + */ + public VirtualMachineUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineUpdateProperties.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineUpdateProperties.java new file mode 100644 index 0000000000000..d4f05b1fd792e --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachineUpdateProperties.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Defines the resource properties. */ +@Fluent +public final class VirtualMachineUpdateProperties { + /* + * Defines the resource properties. + */ + @JsonProperty(value = "hardwareProfile") + private HardwareProfileUpdate hardwareProfile; + + /* + * Defines the resource properties. + */ + @JsonProperty(value = "storageProfile") + private StorageProfileUpdate storageProfile; + + /* + * Defines the resource properties. + */ + @JsonProperty(value = "networkProfile") + private NetworkProfileUpdate networkProfile; + + /* + * Availability Sets in vm. + */ + @JsonProperty(value = "availabilitySets") + private List availabilitySets; + + /** + * Get the hardwareProfile property: Defines the resource properties. + * + * @return the hardwareProfile value. + */ + public HardwareProfileUpdate hardwareProfile() { + return this.hardwareProfile; + } + + /** + * Set the hardwareProfile property: Defines the resource properties. + * + * @param hardwareProfile the hardwareProfile value to set. + * @return the VirtualMachineUpdateProperties object itself. + */ + public VirtualMachineUpdateProperties withHardwareProfile(HardwareProfileUpdate hardwareProfile) { + this.hardwareProfile = hardwareProfile; + return this; + } + + /** + * Get the storageProfile property: Defines the resource properties. + * + * @return the storageProfile value. + */ + public StorageProfileUpdate storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile property: Defines the resource properties. + * + * @param storageProfile the storageProfile value to set. + * @return the VirtualMachineUpdateProperties object itself. + */ + public VirtualMachineUpdateProperties withStorageProfile(StorageProfileUpdate storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get the networkProfile property: Defines the resource properties. + * + * @return the networkProfile value. + */ + public NetworkProfileUpdate networkProfile() { + return this.networkProfile; + } + + /** + * Set the networkProfile property: Defines the resource properties. + * + * @param networkProfile the networkProfile value to set. + * @return the VirtualMachineUpdateProperties object itself. + */ + public VirtualMachineUpdateProperties withNetworkProfile(NetworkProfileUpdate networkProfile) { + this.networkProfile = networkProfile; + return this; + } + + /** + * Get the availabilitySets property: Availability Sets in vm. + * + * @return the availabilitySets value. + */ + public List availabilitySets() { + return this.availabilitySets; + } + + /** + * Set the availabilitySets property: Availability Sets in vm. + * + * @param availabilitySets the availabilitySets value to set. + * @return the VirtualMachineUpdateProperties object itself. + */ + public VirtualMachineUpdateProperties withAvailabilitySets(List availabilitySets) { + this.availabilitySets = availabilitySets; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (hardwareProfile() != null) { + hardwareProfile().validate(); + } + if (storageProfile() != null) { + storageProfile().validate(); + } + if (networkProfile() != null) { + networkProfile().validate(); + } + if (availabilitySets() != null) { + availabilitySets().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachines.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachines.java new file mode 100644 index 0000000000000..fb093d4afe8cf --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualMachines.java @@ -0,0 +1,369 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.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 { + /** + * Implements VirtualMachine GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition. + */ + VirtualMachine getByResourceGroup(String resourceGroupName, String virtualMachineName); + + /** + * Implements VirtualMachine GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualMachineName, Context context); + + /** + * Deletes a VirtualMachine deployed on ScVmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param retain Whether to just disable the VM from azure and retain the VM in the VMM. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualMachineName, Boolean retain, Boolean force); + + /** + * Deletes a VirtualMachine deployed on ScVmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualMachineName); + + /** + * Deletes a VirtualMachine deployed on ScVmm fabric. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param retain Whether to just disable the VM from azure and retain the VM in the VMM. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualMachineName, Boolean retain, Boolean force, Context context); + + /** + * Stop virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine stop action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stop(String resourceGroupName, String virtualMachineName, StopVirtualMachineOptions body); + + /** + * Stop virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stop(String resourceGroupName, String virtualMachineName); + + /** + * Stop virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine stop action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stop(String resourceGroupName, String virtualMachineName, StopVirtualMachineOptions body, Context context); + + /** + * Start virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(String resourceGroupName, String virtualMachineName); + + /** + * Start virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(String resourceGroupName, String virtualMachineName, Context context); + + /** + * Restart virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(String resourceGroupName, String virtualMachineName); + + /** + * Restart virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(String resourceGroupName, String virtualMachineName, Context context); + + /** + * Creates a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine create checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 createCheckpoint(String resourceGroupName, String virtualMachineName, VirtualMachineCreateCheckpoint body); + + /** + * Creates a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 createCheckpoint(String resourceGroupName, String virtualMachineName); + + /** + * Creates a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine create checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 createCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineCreateCheckpoint body, Context context); + + /** + * Deletes a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine delete checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 deleteCheckpoint(String resourceGroupName, String virtualMachineName, VirtualMachineDeleteCheckpoint body); + + /** + * Deletes a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 deleteCheckpoint(String resourceGroupName, String virtualMachineName); + + /** + * Deletes a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine delete checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 deleteCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineDeleteCheckpoint body, Context context); + + /** + * Restores to a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine restore checkpoint action payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 restoreCheckpoint(String resourceGroupName, String virtualMachineName, VirtualMachineRestoreCheckpoint body); + + /** + * Restores to a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 restoreCheckpoint(String resourceGroupName, String virtualMachineName); + + /** + * Restores to a checkpoint in virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param virtualMachineName Name of the VirtualMachine. + * @param body Virtualmachine restore checkpoint action payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 restoreCheckpoint( + String resourceGroupName, String virtualMachineName, VirtualMachineRestoreCheckpoint body, Context context); + + /** + * List of VirtualMachines in 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 list of VirtualMachines as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of VirtualMachines 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.core.management.exception.ManagementException 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 VirtualMachines as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List of VirtualMachines in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualMachines as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List of VirtualMachines in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualMachines as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Implements VirtualMachine GET method. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition along with {@link Response}. + */ + VirtualMachine getById(String id); + + /** + * Implements VirtualMachine GET method. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualMachines resource definition along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a VirtualMachine deployed on ScVmm fabric. + * + * @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 VirtualMachine deployed on ScVmm fabric. + * + * @param id the resource ID. + * @param retain Whether to just disable the VM from azure and retain the VM in the VMM. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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, Boolean retain, Boolean force, 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/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualNetwork.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualNetwork.java new file mode 100644 index 0000000000000..f9bf172f481d5 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualNetwork.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.fluent.models.VirtualNetworkInner; +import java.util.Map; + +/** An immutable client-side representation of VirtualNetwork. */ +public interface VirtualNetwork { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: The system data. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the extendedLocation property: The extended location. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the inventoryItemId property: Gets or sets the inventory Item ID for the resource. + * + * @return the inventoryItemId value. + */ + String inventoryItemId(); + + /** + * Gets the uuid property: Unique ID of the virtual network. + * + * @return the uuid value. + */ + String uuid(); + + /** + * Gets the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides. + * + * @return the vmmServerId value. + */ + String vmmServerId(); + + /** + * Gets the networkName property: Name of the virtual network in vmmServer. + * + * @return the networkName value. + */ + String networkName(); + + /** + * Gets the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.scvmm.fluent.models.VirtualNetworkInner object. + * + * @return the inner object. + */ + VirtualNetworkInner innerModel(); + + /** The entirety of the VirtualNetwork definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithExtendedLocation, + DefinitionStages.WithCreate { + } + /** The VirtualNetwork definition stages. */ + interface DefinitionStages { + /** The first stage of the VirtualNetwork definition. */ + interface Blank extends WithLocation { + } + /** The stage of the VirtualNetwork 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 VirtualNetwork definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithExtendedLocation withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the VirtualNetwork definition allowing to specify extendedLocation. */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extended location.. + * + * @param extendedLocation The extended location. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + /** + * The stage of the VirtualNetwork 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.WithInventoryItemId, + DefinitionStages.WithUuid, + DefinitionStages.WithVmmServerId { + /** + * Executes the create request. + * + * @return the created resource. + */ + VirtualNetwork create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + VirtualNetwork create(Context context); + } + /** The stage of the VirtualNetwork 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 VirtualNetwork definition allowing to specify inventoryItemId. */ + interface WithInventoryItemId { + /** + * Specifies the inventoryItemId property: Gets or sets the inventory Item ID for the resource.. + * + * @param inventoryItemId Gets or sets the inventory Item ID for the resource. + * @return the next definition stage. + */ + WithCreate withInventoryItemId(String inventoryItemId); + } + /** The stage of the VirtualNetwork definition allowing to specify uuid. */ + interface WithUuid { + /** + * Specifies the uuid property: Unique ID of the virtual network.. + * + * @param uuid Unique ID of the virtual network. + * @return the next definition stage. + */ + WithCreate withUuid(String uuid); + } + /** The stage of the VirtualNetwork definition allowing to specify vmmServerId. */ + interface WithVmmServerId { + /** + * Specifies the vmmServerId property: ARM Id of the vmmServer resource in which this resource resides.. + * + * @param vmmServerId ARM Id of the vmmServer resource in which this resource resides. + * @return the next definition stage. + */ + WithCreate withVmmServerId(String vmmServerId); + } + } + /** + * Begins update for the VirtualNetwork resource. + * + * @return the stage of resource update. + */ + VirtualNetwork.Update update(); + + /** The template for VirtualNetwork update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + VirtualNetwork apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + VirtualNetwork apply(Context context); + } + /** The VirtualNetwork update stages. */ + interface UpdateStages { + /** The stage of the VirtualNetwork 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. + */ + VirtualNetwork refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + VirtualNetwork refresh(Context context); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualNetworkInventoryItem.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualNetworkInventoryItem.java new file mode 100644 index 0000000000000..6df26a0994154 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualNetworkInventoryItem.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.scvmm.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.scvmm.fluent.models.InventoryItemProperties; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The Virtual network inventory item. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "inventoryType") +@JsonTypeName("VirtualNetwork") +@Immutable +public final class VirtualNetworkInventoryItem extends InventoryItemProperties { + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualNetworkListResult.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualNetworkListResult.java new file mode 100644 index 0000000000000..61200ecfeccf4 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualNetworkListResult.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.scvmm.fluent.models.VirtualNetworkInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of VirtualNetworks. */ +@Fluent +public final class VirtualNetworkListResult { + /* + * List of VirtualNetworks. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Url to follow for getting next page of resources. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of VirtualNetworks. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of VirtualNetworks. + * + * @param value the value value to set. + * @return the VirtualNetworkListResult object itself. + */ + public VirtualNetworkListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Url to follow for getting next page of resources. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to follow for getting next page of resources. + * + * @param nextLink the nextLink value to set. + * @return the VirtualNetworkListResult object itself. + */ + public VirtualNetworkListResult 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/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualNetworks.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualNetworks.java new file mode 100644 index 0000000000000..2cbe5de1dda5e --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VirtualNetworks.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.scvmm.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 VirtualNetworks. */ +public interface VirtualNetworks { + /** + * Implements VirtualNetwork GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition. + */ + VirtualNetwork getByResourceGroup(String resourceGroupName, String virtualNetworkName); + + /** + * Implements VirtualNetwork GET method. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualNetworkName, Context context); + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualNetworkName, Boolean force); + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualNetworkName); + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName Name of the VirtualNetwork. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualNetworkName, Boolean force, Context context); + + /** + * List of VirtualNetworks in 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 list of VirtualNetworks as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of VirtualNetworks 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.core.management.exception.ManagementException 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 VirtualNetworks as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List of VirtualNetworks in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualNetworks as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List of VirtualNetworks in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VirtualNetworks as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Implements VirtualNetwork GET method. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition along with {@link Response}. + */ + VirtualNetwork getById(String id); + + /** + * Implements VirtualNetwork GET method. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VirtualNetworks resource definition along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @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); + + /** + * Deregisters the ScVmm virtual network from Azure. + * + * @param id the resource ID. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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, Boolean force, Context context); + + /** + * Begins definition for a new VirtualNetwork resource. + * + * @param name resource name. + * @return the first stage of the new VirtualNetwork definition. + */ + VirtualNetwork.DefinitionStages.Blank define(String name); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VmmServer.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VmmServer.java new file mode 100644 index 0000000000000..94a4d83a9e384 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VmmServer.java @@ -0,0 +1,306 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scvmm.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.fluent.models.VmmServerInner; +import java.util.Map; + +/** An immutable client-side representation of VmmServer. */ +public interface VmmServer { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: The system data. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the extendedLocation property: The extended location. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the credentials property: Credentials to connect to VMMServer. + * + * @return the credentials value. + */ + VmmServerPropertiesCredentials credentials(); + + /** + * Gets the fqdn property: Fqdn is the hostname/ip of the vmmServer. + * + * @return the fqdn value. + */ + String fqdn(); + + /** + * Gets the port property: Port is the port on which the vmmServer is listening. + * + * @return the port value. + */ + Integer port(); + + /** + * Gets the connectionStatus property: Gets or sets the connection status to the vmmServer. + * + * @return the connectionStatus value. + */ + String connectionStatus(); + + /** + * Gets the errorMessage property: Gets or sets any error message if connection to vmmServer is having any issue. + * + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * Gets the uuid property: Unique ID of vmmServer. + * + * @return the uuid value. + */ + String uuid(); + + /** + * Gets the version property: Version is the version of the vmmSever. + * + * @return the version value. + */ + String version(); + + /** + * Gets the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.scvmm.fluent.models.VmmServerInner object. + * + * @return the inner object. + */ + VmmServerInner innerModel(); + + /** The entirety of the VmmServer definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithExtendedLocation, + DefinitionStages.WithFqdn, + DefinitionStages.WithCreate { + } + /** The VmmServer definition stages. */ + interface DefinitionStages { + /** The first stage of the VmmServer definition. */ + interface Blank extends WithLocation { + } + /** The stage of the VmmServer 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 VmmServer definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithExtendedLocation withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the VmmServer definition allowing to specify extendedLocation. */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extended location.. + * + * @param extendedLocation The extended location. + * @return the next definition stage. + */ + WithFqdn withExtendedLocation(ExtendedLocation extendedLocation); + } + /** The stage of the VmmServer definition allowing to specify fqdn. */ + interface WithFqdn { + /** + * Specifies the fqdn property: Fqdn is the hostname/ip of the vmmServer.. + * + * @param fqdn Fqdn is the hostname/ip of the vmmServer. + * @return the next definition stage. + */ + WithCreate withFqdn(String fqdn); + } + /** + * The stage of the VmmServer 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.WithCredentials, DefinitionStages.WithPort { + /** + * Executes the create request. + * + * @return the created resource. + */ + VmmServer create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + VmmServer create(Context context); + } + /** The stage of the VmmServer 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 VmmServer definition allowing to specify credentials. */ + interface WithCredentials { + /** + * Specifies the credentials property: Credentials to connect to VMMServer.. + * + * @param credentials Credentials to connect to VMMServer. + * @return the next definition stage. + */ + WithCreate withCredentials(VmmServerPropertiesCredentials credentials); + } + /** The stage of the VmmServer definition allowing to specify port. */ + interface WithPort { + /** + * Specifies the port property: Port is the port on which the vmmServer is listening.. + * + * @param port Port is the port on which the vmmServer is listening. + * @return the next definition stage. + */ + WithCreate withPort(Integer port); + } + } + /** + * Begins update for the VmmServer resource. + * + * @return the stage of resource update. + */ + VmmServer.Update update(); + + /** The template for VmmServer update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + VmmServer apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + VmmServer apply(Context context); + } + /** The VmmServer update stages. */ + interface UpdateStages { + /** The stage of the VmmServer 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. + */ + VmmServer refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + VmmServer refresh(Context context); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VmmServerListResult.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VmmServerListResult.java new file mode 100644 index 0000000000000..00c63a30b8c97 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VmmServerListResult.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.scvmm.fluent.models.VmmServerInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of VmmServers. */ +@Fluent +public final class VmmServerListResult { + /* + * List of VmmServers. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Url to follow for getting next page of resources. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of VmmServers. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of VmmServers. + * + * @param value the value value to set. + * @return the VmmServerListResult object itself. + */ + public VmmServerListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Url to follow for getting next page of resources. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to follow for getting next page of resources. + * + * @param nextLink the nextLink value to set. + * @return the VmmServerListResult object itself. + */ + public VmmServerListResult 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/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VmmServerPropertiesCredentials.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VmmServerPropertiesCredentials.java new file mode 100644 index 0000000000000..e2827163e05b3 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VmmServerPropertiesCredentials.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.scvmm.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Credentials to connect to VMMServer. */ +@Fluent +public final class VmmServerPropertiesCredentials { + /* + * Username to use to connect to VMMServer. + */ + @JsonProperty(value = "username") + private String username; + + /* + * Credentials to use to connect to VMMServer. + */ + @JsonProperty(value = "password") + private String password; + + /** + * Get the username property: Username to use to connect to VMMServer. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: Username to use to connect to VMMServer. + * + * @param username the username value to set. + * @return the VmmServerPropertiesCredentials object itself. + */ + public VmmServerPropertiesCredentials withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: Credentials to use to connect to VMMServer. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: Credentials to use to connect to VMMServer. + * + * @param password the password value to set. + * @return the VmmServerPropertiesCredentials object itself. + */ + public VmmServerPropertiesCredentials withPassword(String password) { + this.password = password; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VmmServers.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VmmServers.java new file mode 100644 index 0000000000000..4221e56b68eef --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/VmmServers.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.scvmm.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 VmmServers. */ +public interface VmmServers { + /** + * Implements VMMServer GET method. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition. + */ + VmmServer getByResourceGroup(String resourceGroupName, String vmmServerName); + + /** + * Implements VMMServer GET method. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String vmmServerName, Context context); + + /** + * Deboards the SCVMM fabric from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 vmmServerName, Boolean force); + + /** + * Deboards the SCVMM fabric from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 vmmServerName); + + /** + * Deboards the SCVMM fabric from Azure. + * + * @param resourceGroupName The name of the resource group. + * @param vmmServerName Name of the VMMServer. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 vmmServerName, Boolean force, Context context); + + /** + * List of VmmServers in 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 list of VmmServers as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of VmmServers 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.core.management.exception.ManagementException 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 VmmServers as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List of VmmServers in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VmmServers as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List of VmmServers in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of VmmServers as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Implements VMMServer GET method. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition along with {@link Response}. + */ + VmmServer getById(String id); + + /** + * Implements VMMServer GET method. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the VmmServers resource definition along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deboards the SCVMM fabric from Azure. + * + * @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); + + /** + * Deboards the SCVMM fabric from Azure. + * + * @param id the resource ID. + * @param force Forces the resource to be deleted from azure. The corresponding CR would be attempted to be deleted + * too. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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, Boolean force, Context context); + + /** + * Begins definition for a new VmmServer resource. + * + * @param name resource name. + * @return the first stage of the new VmmServer definition. + */ + VmmServer.DefinitionStages.Blank define(String name); +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/package-info.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/models/package-info.java new file mode 100644 index 0000000000000..369408205b461 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/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 ScvmmClient. SCVMM Client. */ +package com.azure.resourcemanager.scvmm.models; diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/package-info.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/package-info.java new file mode 100644 index 0000000000000..11ebca94ed958 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/com/azure/resourcemanager/scvmm/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 ScvmmClient. SCVMM Client. */ +package com.azure.resourcemanager.scvmm; diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/module-info.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/main/java/module-info.java new file mode 100644 index 0000000000000..7c61b963233e8 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/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.scvmm { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.scvmm; + exports com.azure.resourcemanager.scvmm.fluent; + exports com.azure.resourcemanager.scvmm.fluent.models; + exports com.azure.resourcemanager.scvmm.models; + + opens com.azure.resourcemanager.scvmm.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.scvmm.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/AvailabilitySetsCreateOrUpdateSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/AvailabilitySetsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..d5bdac68b9442 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/AvailabilitySetsCreateOrUpdateSamples.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.scvmm.generated; + +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; + +/** Samples for AvailabilitySets CreateOrUpdate. */ +public final class AvailabilitySetsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateAvailabilitySet.json + */ + /** + * Sample code: CreateAvailabilitySet. + * + * @param manager Entry point to ScvmmManager. + */ + public static void createAvailabilitySet(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .availabilitySets() + .define("HRAvailabilitySet") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.Arc/customLocations/contoso")) + .withAvailabilitySetName("hr-avset") + .withVmmServerId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ScVmm/VMMServers/ContosoVMMServer") + .create(); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/AvailabilitySetsDeleteSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/AvailabilitySetsDeleteSamples.java new file mode 100644 index 0000000000000..dc103356c547c --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/AvailabilitySetsDeleteSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for AvailabilitySets Delete. */ +public final class AvailabilitySetsDeleteSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteAvailabilitySet.json + */ + /** + * Sample code: DeleteAvailabilitySet. + * + * @param manager Entry point to ScvmmManager. + */ + public static void deleteAvailabilitySet(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.availabilitySets().delete("testrg", "HRAvailabilitySet", null, Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/AvailabilitySetsGetByResourceGroupSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/AvailabilitySetsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..6a2aa1689df39 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/AvailabilitySetsGetByResourceGroupSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for AvailabilitySets GetByResourceGroup. */ +public final class AvailabilitySetsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetAvailabilitySet.json + */ + /** + * Sample code: GetAvailabilitySet. + * + * @param manager Entry point to ScvmmManager. + */ + public static void getAvailabilitySet(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.availabilitySets().getByResourceGroupWithResponse("testrg", "HRAvailabilitySet", Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/AvailabilitySetsListByResourceGroupSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/AvailabilitySetsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..eb7804b03ef68 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/AvailabilitySetsListByResourceGroupSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for AvailabilitySets ListByResourceGroup. */ +public final class AvailabilitySetsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListAvailabilitySetsByResourceGroup.json + */ + /** + * Sample code: ListAvailabilitySetsByResourceGroup. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listAvailabilitySetsByResourceGroup(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.availabilitySets().listByResourceGroup("testrg", Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/AvailabilitySetsListSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/AvailabilitySetsListSamples.java new file mode 100644 index 0000000000000..0bea664ec386c --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/AvailabilitySetsListSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for AvailabilitySets List. */ +public final class AvailabilitySetsListSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListAvailabilitySetsBySubscription.json + */ + /** + * Sample code: ListAvailabilitySetsBySubscription. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listAvailabilitySetsBySubscription(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.availabilitySets().list(Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/AvailabilitySetsUpdateSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/AvailabilitySetsUpdateSamples.java new file mode 100644 index 0000000000000..231292ddfe5d0 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/AvailabilitySetsUpdateSamples.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.scvmm.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.models.AvailabilitySet; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AvailabilitySets Update. */ +public final class AvailabilitySetsUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateAvailabilitySet.json + */ + /** + * Sample code: UpdateAvailabilitySet. + * + * @param manager Entry point to ScvmmManager. + */ + public static void updateAvailabilitySet(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + AvailabilitySet resource = + manager + .availabilitySets() + .getByResourceGroupWithResponse("testrg", "HRAvailabilitySet", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tag1", "value1", "tag2", "value2")).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/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/CloudsCreateOrUpdateSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/CloudsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..c7b02ce79c460 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/CloudsCreateOrUpdateSamples.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.scvmm.generated; + +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; + +/** Samples for Clouds CreateOrUpdate. */ +public final class CloudsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateCloud.json + */ + /** + * Sample code: CreateCloud. + * + * @param manager Entry point to ScvmmManager. + */ + public static void createCloud(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .clouds() + .define("HRCloud") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.Arc/customLocations/contoso")) + .withUuid("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .withVmmServerId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.SCVMM/VMMServers/ContosoVMMServer") + .create(); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/CloudsDeleteSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/CloudsDeleteSamples.java new file mode 100644 index 0000000000000..506afbb4b0008 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/CloudsDeleteSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for Clouds Delete. */ +public final class CloudsDeleteSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteCloud.json + */ + /** + * Sample code: DeleteCloud. + * + * @param manager Entry point to ScvmmManager. + */ + public static void deleteCloud(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.clouds().delete("testrg", "HRCloud", null, Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/CloudsGetByResourceGroupSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/CloudsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..ff6eb4040f53b --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/CloudsGetByResourceGroupSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for Clouds GetByResourceGroup. */ +public final class CloudsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetCloud.json + */ + /** + * Sample code: GetCloud. + * + * @param manager Entry point to ScvmmManager. + */ + public static void getCloud(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.clouds().getByResourceGroupWithResponse("testrg", "HRCloud", Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/CloudsListByResourceGroupSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/CloudsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..32ca1c420e7b9 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/CloudsListByResourceGroupSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for Clouds ListByResourceGroup. */ +public final class CloudsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListCloudsByResourceGroup.json + */ + /** + * Sample code: ListCloudsByResourceGroup. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listCloudsByResourceGroup(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.clouds().listByResourceGroup("testrg", Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/CloudsListSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/CloudsListSamples.java new file mode 100644 index 0000000000000..7e76466908e1a --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/CloudsListSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for Clouds List. */ +public final class CloudsListSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListCloudsBySubscription.json + */ + /** + * Sample code: ListCloudsBySubscription. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listCloudsBySubscription(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.clouds().list(Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/CloudsUpdateSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/CloudsUpdateSamples.java new file mode 100644 index 0000000000000..8e6a6709d356f --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/CloudsUpdateSamples.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.scvmm.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.models.Cloud; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Clouds Update. */ +public final class CloudsUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateCloud.json + */ + /** + * Sample code: UpdateCloud. + * + * @param manager Entry point to ScvmmManager. + */ + public static void updateCloud(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + Cloud resource = manager.clouds().getByResourceGroupWithResponse("testrg", "HRCloud", Context.NONE).getValue(); + resource.update().withTags(mapOf("tag1", "value1", "tag2", "value2")).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/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/InventoryItemsCreateSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/InventoryItemsCreateSamples.java new file mode 100644 index 0000000000000..ef44c7251ebcb --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/InventoryItemsCreateSamples.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.scvmm.generated; + +/** Samples for InventoryItems Create. */ +public final class InventoryItemsCreateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateInventoryItem.json + */ + /** + * Sample code: CreateInventoryItem. + * + * @param manager Entry point to ScvmmManager. + */ + public static void createInventoryItem(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .inventoryItems() + .define("12345678-1234-1234-1234-123456789abc") + .withExistingVmmServer("testrg", "ContosoVMMServer") + .create(); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/InventoryItemsDeleteSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/InventoryItemsDeleteSamples.java new file mode 100644 index 0000000000000..b0ca629e3173c --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/InventoryItemsDeleteSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for InventoryItems Delete. */ +public final class InventoryItemsDeleteSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteInventoryItem.json + */ + /** + * Sample code: DeleteInventoryItem. + * + * @param manager Entry point to ScvmmManager. + */ + public static void deleteInventoryItem(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .inventoryItems() + .deleteWithResponse("testrg", "ContosoVMMServer", "12345678-1234-1234-1234-123456789abc", Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/InventoryItemsGetSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/InventoryItemsGetSamples.java new file mode 100644 index 0000000000000..b57ed51d08bf7 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/InventoryItemsGetSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for InventoryItems Get. */ +public final class InventoryItemsGetSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetInventoryItem.json + */ + /** + * Sample code: GetInventoryItem. + * + * @param manager Entry point to ScvmmManager. + */ + public static void getInventoryItem(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .inventoryItems() + .getWithResponse("testrg", "ContosoVMMServer", "12345678-1234-1234-1234-123456789abc", Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/InventoryItemsListByVmmServerSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/InventoryItemsListByVmmServerSamples.java new file mode 100644 index 0000000000000..e1aa3ccb1d780 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/InventoryItemsListByVmmServerSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for InventoryItems ListByVmmServer. */ +public final class InventoryItemsListByVmmServerSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListInventoryItemsByVMMServer.json + */ + /** + * Sample code: InventoryItemsListByVMMServer. + * + * @param manager Entry point to ScvmmManager. + */ + public static void inventoryItemsListByVMMServer(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.inventoryItems().listByVmmServer("testrg", "ContosoVMMServer", Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/OperationsListSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..65cc00aae34cd --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/OperationsListSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListOperations.json + */ + /** + * Sample code: ListOperations. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listOperations(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.operations().list(Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachineTemplatesCreateOrUpdateSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachineTemplatesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..1522f3f1c3245 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachineTemplatesCreateOrUpdateSamples.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.scvmm.generated; + +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; + +/** Samples for VirtualMachineTemplates CreateOrUpdate. */ +public final class VirtualMachineTemplatesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateVirtualMachineTemplate.json + */ + /** + * Sample code: CreateVirtualMachineTemplate. + * + * @param manager Entry point to ScvmmManager. + */ + public static void createVirtualMachineTemplate(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .virtualMachineTemplates() + .define("HRVirtualMachineTemplate") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.Arc/customLocations/contoso")) + .withUuid("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .withVmmServerId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.SCVMM/VMMServers/ContosoVMMServer") + .create(); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachineTemplatesDeleteSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachineTemplatesDeleteSamples.java new file mode 100644 index 0000000000000..132c6732c494b --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachineTemplatesDeleteSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineTemplates Delete. */ +public final class VirtualMachineTemplatesDeleteSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteVirtualMachineTemplate.json + */ + /** + * Sample code: DeleteVirtualMachineTemplate. + * + * @param manager Entry point to ScvmmManager. + */ + public static void deleteVirtualMachineTemplate(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualMachineTemplates().delete("testrg", "HRVirtualMachineTemplate", null, Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachineTemplatesGetByResourceGroupSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachineTemplatesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..40eb29ffef264 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachineTemplatesGetByResourceGroupSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineTemplates GetByResourceGroup. */ +public final class VirtualMachineTemplatesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetVirtualMachineTemplate.json + */ + /** + * Sample code: GetVirtualMachineTemplate. + * + * @param manager Entry point to ScvmmManager. + */ + public static void getVirtualMachineTemplate(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .virtualMachineTemplates() + .getByResourceGroupWithResponse("testrg", "HRVirtualMachineTemplate", Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachineTemplatesListByResourceGroupSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachineTemplatesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..9ed59c28f8a36 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachineTemplatesListByResourceGroupSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineTemplates ListByResourceGroup. */ +public final class VirtualMachineTemplatesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualMachineTemplatesByResourceGroup.json + */ + /** + * Sample code: ListVirtualMachineTemplatesByResourceGroup. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listVirtualMachineTemplatesByResourceGroup( + com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualMachineTemplates().listByResourceGroup("testrg", Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachineTemplatesListSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachineTemplatesListSamples.java new file mode 100644 index 0000000000000..96e8445890082 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachineTemplatesListSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineTemplates List. */ +public final class VirtualMachineTemplatesListSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualMachineTemplatesBySubscription.json + */ + /** + * Sample code: ListVirtualMachineTemplatesBySubscription. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listVirtualMachineTemplatesBySubscription(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualMachineTemplates().list(Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachineTemplatesUpdateSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachineTemplatesUpdateSamples.java new file mode 100644 index 0000000000000..2b4642f6a7c49 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachineTemplatesUpdateSamples.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.scvmm.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.models.VirtualMachineTemplate; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualMachineTemplates Update. */ +public final class VirtualMachineTemplatesUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateVirtualMachineTemplate.json + */ + /** + * Sample code: UpdateVirtualMachineTemplate. + * + * @param manager Entry point to ScvmmManager. + */ + public static void updateVirtualMachineTemplate(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + VirtualMachineTemplate resource = + manager + .virtualMachineTemplates() + .getByResourceGroupWithResponse("testrg", "HRVirtualMachineTemplate", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tag1", "value1", "tag2", "value2")).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/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesCreateCheckpointSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesCreateCheckpointSamples.java new file mode 100644 index 0000000000000..2bfa176dfd3e3 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesCreateCheckpointSamples.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.scvmm.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.models.VirtualMachineCreateCheckpoint; + +/** Samples for VirtualMachines CreateCheckpoint. */ +public final class VirtualMachinesCreateCheckpointSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateCheckpointVirtualMachine.json + */ + /** + * Sample code: CreateCheckpointVirtualMachine. + * + * @param manager Entry point to ScvmmManager. + */ + public static void createCheckpointVirtualMachine(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .virtualMachines() + .createCheckpoint( + "testrg", + "DemoVM", + new VirtualMachineCreateCheckpoint() + .withName("Demo Checkpoint name") + .withDescription("Demo Checkpoint description"), + Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesCreateOrUpdateSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..44437779ba4cd --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesCreateOrUpdateSamples.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.scvmm.generated; + +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; +import com.azure.resourcemanager.scvmm.models.HardwareProfile; + +/** Samples for VirtualMachines CreateOrUpdate. */ +public final class VirtualMachinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateVirtualMachine.json + */ + /** + * Sample code: CreateVirtualMachine. + * + * @param manager Entry point to ScvmmManager. + */ + public static void createVirtualMachine(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .virtualMachines() + .define("DemoVM") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.Arc/customLocations/contoso")) + .withVmmServerId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.SCVMM/VMMServers/ContosoVMMServer") + .withCloudId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.SCVMM/Clouds/HRCloud") + .withTemplateId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.SCVMM/VirtualMachineTemplates/HRVirtualMachineTemplate") + .withHardwareProfile(new HardwareProfile().withMemoryMB(4096).withCpuCount(4)) + .create(); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesDeleteCheckpointSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesDeleteCheckpointSamples.java new file mode 100644 index 0000000000000..4cb530f986069 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesDeleteCheckpointSamples.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.scvmm.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.models.VirtualMachineDeleteCheckpoint; + +/** Samples for VirtualMachines DeleteCheckpoint. */ +public final class VirtualMachinesDeleteCheckpointSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteCheckpointVirtualMachine.json + */ + /** + * Sample code: DeleteCheckpointVirtualMachine. + * + * @param manager Entry point to ScvmmManager. + */ + public static void deleteCheckpointVirtualMachine(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .virtualMachines() + .deleteCheckpoint( + "testrg", "DemoVM", new VirtualMachineDeleteCheckpoint().withId("Demo CheckpointID"), Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesDeleteSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesDeleteSamples.java new file mode 100644 index 0000000000000..540e243db908b --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Delete. */ +public final class VirtualMachinesDeleteSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteVirtualMachine.json + */ + /** + * Sample code: DeleteVirtualMachine. + * + * @param manager Entry point to ScvmmManager. + */ + public static void deleteVirtualMachine(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualMachines().delete("testrg", "DemoVM", null, null, Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesGetByResourceGroupSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..8cf7ec5e84d97 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesGetByResourceGroupSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines GetByResourceGroup. */ +public final class VirtualMachinesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetVirtualMachine.json + */ + /** + * Sample code: GetVirtualMachine. + * + * @param manager Entry point to ScvmmManager. + */ + public static void getVirtualMachine(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualMachines().getByResourceGroupWithResponse("testrg", "DemoVM", Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesListByResourceGroupSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..a922514c1544b --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesListByResourceGroupSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines ListByResourceGroup. */ +public final class VirtualMachinesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualMachinesByResourceGroup.json + */ + /** + * Sample code: ListVirtualMachinesByResourceGroup. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listVirtualMachinesByResourceGroup(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualMachines().listByResourceGroup("testrg", Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesListSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesListSamples.java new file mode 100644 index 0000000000000..a52ffb96093a1 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesListSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines List. */ +public final class VirtualMachinesListSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualMachinesBySubscription.json + */ + /** + * Sample code: ListVirtualMachinesBySubscription. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listVirtualMachinesBySubscription(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualMachines().list(Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesRestartSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesRestartSamples.java new file mode 100644 index 0000000000000..35c095e9d962d --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesRestartSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Restart. */ +public final class VirtualMachinesRestartSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/RestartVirtualMachine.json + */ + /** + * Sample code: RestartVirtualMachine. + * + * @param manager Entry point to ScvmmManager. + */ + public static void restartVirtualMachine(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualMachines().restart("testrg", "DemoVM", Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesRestoreCheckpointSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesRestoreCheckpointSamples.java new file mode 100644 index 0000000000000..0c35d2d2e75b0 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesRestoreCheckpointSamples.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.scvmm.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.models.VirtualMachineRestoreCheckpoint; + +/** Samples for VirtualMachines RestoreCheckpoint. */ +public final class VirtualMachinesRestoreCheckpointSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/RestoreCheckpointVirtualMachine.json + */ + /** + * Sample code: RestoreCheckpointVirtualMachine. + * + * @param manager Entry point to ScvmmManager. + */ + public static void restoreCheckpointVirtualMachine(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .virtualMachines() + .restoreCheckpoint( + "testrg", "DemoVM", new VirtualMachineRestoreCheckpoint().withId("Demo CheckpointID"), Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesStartSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesStartSamples.java new file mode 100644 index 0000000000000..0f1755f6fbd30 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesStartSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Start. */ +public final class VirtualMachinesStartSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/StartVirtualMachine.json + */ + /** + * Sample code: StartVirtualMachine. + * + * @param manager Entry point to ScvmmManager. + */ + public static void startVirtualMachine(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualMachines().start("testrg", "DemoVM", Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesStopSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesStopSamples.java new file mode 100644 index 0000000000000..624c64247cd37 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesStopSamples.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.scvmm.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.models.StopVirtualMachineOptions; + +/** Samples for VirtualMachines Stop. */ +public final class VirtualMachinesStopSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/StopVirtualMachine.json + */ + /** + * Sample code: StopVirtualMachine. + * + * @param manager Entry point to ScvmmManager. + */ + public static void stopVirtualMachine(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .virtualMachines() + .stop("testrg", "DemoVM", new StopVirtualMachineOptions().withSkipShutdown(true), Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesUpdateSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesUpdateSamples.java new file mode 100644 index 0000000000000..7fa16fd3d3126 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualMachinesUpdateSamples.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.scvmm.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.models.AllocationMethod; +import com.azure.resourcemanager.scvmm.models.HardwareProfileUpdate; +import com.azure.resourcemanager.scvmm.models.NetworkInterfacesUpdate; +import com.azure.resourcemanager.scvmm.models.NetworkProfileUpdate; +import com.azure.resourcemanager.scvmm.models.StorageProfileUpdate; +import com.azure.resourcemanager.scvmm.models.VirtualDiskUpdate; +import com.azure.resourcemanager.scvmm.models.VirtualMachine; +import com.azure.resourcemanager.scvmm.models.VirtualMachineUpdateProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualMachines Update. */ +public final class VirtualMachinesUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateVirtualMachine.json + */ + /** + * Sample code: UpdateVirtualMachine. + * + * @param manager Entry point to ScvmmManager. + */ + public static void updateVirtualMachine(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + VirtualMachine resource = + manager.virtualMachines().getByResourceGroupWithResponse("testrg", "DemoVM", Context.NONE).getValue(); + resource + .update() + .withTags(mapOf("tag1", "value1", "tag2", "value2")) + .withProperties( + new VirtualMachineUpdateProperties() + .withHardwareProfile(new HardwareProfileUpdate().withMemoryMB(4096).withCpuCount(4)) + .withStorageProfile( + new StorageProfileUpdate() + .withDisks(Arrays.asList(new VirtualDiskUpdate().withName("test").withDiskSizeGB(10)))) + .withNetworkProfile( + new NetworkProfileUpdate() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfacesUpdate() + .withName("test") + .withIpv4AddressType(AllocationMethod.DYNAMIC) + .withIpv6AddressType(AllocationMethod.DYNAMIC) + .withMacAddressType(AllocationMethod.STATIC))))) + .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/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualNetworksCreateOrUpdateSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualNetworksCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..a61025cc0d564 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualNetworksCreateOrUpdateSamples.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.scvmm.generated; + +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; + +/** Samples for VirtualNetworks CreateOrUpdate. */ +public final class VirtualNetworksCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateVirtualNetwork.json + */ + /** + * Sample code: CreateVirtualNetwork. + * + * @param manager Entry point to ScvmmManager. + */ + public static void createVirtualNetwork(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .virtualNetworks() + .define("HRVirtualNetwork") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.Arc/customLocations/contoso")) + .withUuid("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .withVmmServerId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.SCVMM/VMMServers/ContosoVMMServer") + .create(); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualNetworksDeleteSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualNetworksDeleteSamples.java new file mode 100644 index 0000000000000..9225f89573226 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualNetworksDeleteSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworks Delete. */ +public final class VirtualNetworksDeleteSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteVirtualNetwork.json + */ + /** + * Sample code: DeleteVirtualNetwork. + * + * @param manager Entry point to ScvmmManager. + */ + public static void deleteVirtualNetwork(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualNetworks().delete("testrg", "HRVirtualNetwork", null, Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualNetworksGetByResourceGroupSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualNetworksGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..7afaf26c5de68 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualNetworksGetByResourceGroupSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworks GetByResourceGroup. */ +public final class VirtualNetworksGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetVirtualNetwork.json + */ + /** + * Sample code: GetVirtualNetwork. + * + * @param manager Entry point to ScvmmManager. + */ + public static void getVirtualNetwork(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualNetworks().getByResourceGroupWithResponse("testrg", "HRVirtualNetwork", Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualNetworksListByResourceGroupSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualNetworksListByResourceGroupSamples.java new file mode 100644 index 0000000000000..fcd09724fc32b --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualNetworksListByResourceGroupSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworks ListByResourceGroup. */ +public final class VirtualNetworksListByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualNetworksByResourceGroup.json + */ + /** + * Sample code: ListVirtualNetworksByResourceGroup. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listVirtualNetworksByResourceGroup(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualNetworks().listByResourceGroup("testrg", Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualNetworksListSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualNetworksListSamples.java new file mode 100644 index 0000000000000..c21217a44daf7 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualNetworksListSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworks List. */ +public final class VirtualNetworksListSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVirtualNetworksBySubscription.json + */ + /** + * Sample code: ListVirtualNetworksBySubscription. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listVirtualNetworksBySubscription(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.virtualNetworks().list(Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualNetworksUpdateSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualNetworksUpdateSamples.java new file mode 100644 index 0000000000000..49b5f8e580c6d --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VirtualNetworksUpdateSamples.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.scvmm.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.models.VirtualNetwork; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualNetworks Update. */ +public final class VirtualNetworksUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateVirtualNetwork.json + */ + /** + * Sample code: UpdateVirtualNetwork. + * + * @param manager Entry point to ScvmmManager. + */ + public static void updateVirtualNetwork(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + VirtualNetwork resource = + manager + .virtualNetworks() + .getByResourceGroupWithResponse("testrg", "HRVirtualNetwork", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tag1", "value1", "tag2", "value2")).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/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VmmServersCreateOrUpdateSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VmmServersCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..96700ee58fd0b --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VmmServersCreateOrUpdateSamples.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.scvmm.generated; + +import com.azure.resourcemanager.scvmm.models.ExtendedLocation; +import com.azure.resourcemanager.scvmm.models.VmmServerPropertiesCredentials; + +/** Samples for VmmServers CreateOrUpdate. */ +public final class VmmServersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/CreateVMMServer.json + */ + /** + * Sample code: CreateVMMServer. + * + * @param manager Entry point to ScvmmManager. + */ + public static void createVMMServer(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager + .vmmServers() + .define("ContosoVMMServer") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.Arc/customLocations/contoso")) + .withFqdn("VMM.contoso.com") + .withCredentials(new VmmServerPropertiesCredentials().withUsername("testuser").withPassword("password")) + .withPort(1234) + .create(); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VmmServersDeleteSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VmmServersDeleteSamples.java new file mode 100644 index 0000000000000..b81f2897402c0 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VmmServersDeleteSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for VmmServers Delete. */ +public final class VmmServersDeleteSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/DeleteVMMServer.json + */ + /** + * Sample code: DeleteVMMServer. + * + * @param manager Entry point to ScvmmManager. + */ + public static void deleteVMMServer(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.vmmServers().delete("testrg", "ContosoVMMServer", null, Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VmmServersGetByResourceGroupSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VmmServersGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..f2a411762b3df --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VmmServersGetByResourceGroupSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for VmmServers GetByResourceGroup. */ +public final class VmmServersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/GetVMMServer.json + */ + /** + * Sample code: GetVMMServer. + * + * @param manager Entry point to ScvmmManager. + */ + public static void getVMMServer(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.vmmServers().getByResourceGroupWithResponse("testrg", "ContosoVMMServer", Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VmmServersListByResourceGroupSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VmmServersListByResourceGroupSamples.java new file mode 100644 index 0000000000000..bd4607ef1ea92 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VmmServersListByResourceGroupSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for VmmServers ListByResourceGroup. */ +public final class VmmServersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVMMServersByResourceGroup.json + */ + /** + * Sample code: ListVmmServersByResourceGroup. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listVmmServersByResourceGroup(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.vmmServers().listByResourceGroup("testrg", Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VmmServersListSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VmmServersListSamples.java new file mode 100644 index 0000000000000..d10eabbf6d536 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VmmServersListSamples.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.scvmm.generated; + +import com.azure.core.util.Context; + +/** Samples for VmmServers List. */ +public final class VmmServersListSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/ListVMMServersBySubscription.json + */ + /** + * Sample code: ListVmmServersBySubscription. + * + * @param manager Entry point to ScvmmManager. + */ + public static void listVmmServersBySubscription(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + manager.vmmServers().list(Context.NONE); + } +} diff --git a/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VmmServersUpdateSamples.java b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VmmServersUpdateSamples.java new file mode 100644 index 0000000000000..9c3390e5c6e12 --- /dev/null +++ b/sdk/scvmm/azure-resourcemanager-scvmm/src/samples/java/com/azure/resourcemanager/scvmm/generated/VmmServersUpdateSamples.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.scvmm.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.scvmm.models.VmmServer; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VmmServers Update. */ +public final class VmmServersUpdateSamples { + /* + * x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/preview/2020-06-05-preview/examples/UpdateVMMServer.json + */ + /** + * Sample code: UpdateVMMServer. + * + * @param manager Entry point to ScvmmManager. + */ + public static void updateVMMServer(com.azure.resourcemanager.scvmm.ScvmmManager manager) { + VmmServer resource = + manager.vmmServers().getByResourceGroupWithResponse("testrg", "ContosoVMMServer", Context.NONE).getValue(); + resource.update().withTags(mapOf("tag1", "value1", "tag2", "value2")).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/scvmm/ci.yml b/sdk/scvmm/ci.yml new file mode 100644 index 0000000000000..88eb06bea1d73 --- /dev/null +++ b/sdk/scvmm/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/scvmm/ci.yml + - sdk/scvmm/azure-resourcemanager-scvmm/ + exclude: + - sdk/scvmm/pom.xml + - sdk/scvmm/azure-resourcemanager-scvmm/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/scvmm/ci.yml + - sdk/scvmm/azure-resourcemanager-scvmm/ + exclude: + - sdk/scvmm/pom.xml + - sdk/scvmm/azure-resourcemanager-scvmm/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: scvmm + Artifacts: + - name: azure-resourcemanager-scvmm + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerscvmm diff --git a/sdk/scvmm/pom.xml b/sdk/scvmm/pom.xml new file mode 100644 index 0000000000000..625c485bc652a --- /dev/null +++ b/sdk/scvmm/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-scvmm-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-scvmm + + + +