diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 920d2124089f..d33cc3c6ab9c 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -340,6 +340,7 @@ com.azure.resourcemanager:azure-resourcemanager-servicelinker;1.0.0-beta.1;1.0.0 com.azure.resourcemanager:azure-resourcemanager-appcontainers;1.0.0-beta.2;1.0.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-scvmm;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-hardwaresecuritymodules;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-connectedvmware;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 b1f52a5607a6..b0f8b47b4489 100644 --- a/pom.xml +++ b/pom.xml @@ -868,6 +868,7 @@ sdk/communication sdk/confidentialledger sdk/confluent + sdk/connectedvmware sdk/consumption sdk/containerregistry sdk/core diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/CHANGELOG.md b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/CHANGELOG.md new file mode 100644 index 000000000000..55517aa6e3b7 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-05-11) + +- Azure Resource Manager ConnectedVMware client library for Java. This package contains Microsoft Azure SDK for ConnectedVMware Management SDK. Connected VMware Client. Package tag package-2020-10-01-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/connectedvmware/azure-resourcemanager-connectedvmware/README.md b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/README.md new file mode 100644 index 000000000000..495bd56a2e2c --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager ConnectedVMware client library for Java + +Azure Resource Manager ConnectedVMware client library for Java. + +This package contains Microsoft Azure SDK for ConnectedVMware Management SDK. Connected VMware Client. Package tag package-2020-10-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-connectedvmware;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-connectedvmware + 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(); +ConnectedVMwareManager manager = ConnectedVMwareManager + .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/connectedvmware/azure-resourcemanager-connectedvmware/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/connectedvmware/azure-resourcemanager-connectedvmware/SAMPLE.md b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/SAMPLE.md new file mode 100644 index 000000000000..2c3c44ab57bc --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/SAMPLE.md @@ -0,0 +1,1878 @@ +# Code snippets and samples + + +## Clusters + +- [Create](#clusters_create) +- [Delete](#clusters_delete) +- [GetByResourceGroup](#clusters_getbyresourcegroup) +- [List](#clusters_list) +- [ListByResourceGroup](#clusters_listbyresourcegroup) +- [Update](#clusters_update) + +## Datastores + +- [Create](#datastores_create) +- [Delete](#datastores_delete) +- [GetByResourceGroup](#datastores_getbyresourcegroup) +- [List](#datastores_list) +- [ListByResourceGroup](#datastores_listbyresourcegroup) +- [Update](#datastores_update) + +## GuestAgents + +- [Create](#guestagents_create) +- [Delete](#guestagents_delete) +- [Get](#guestagents_get) +- [ListByVm](#guestagents_listbyvm) + +## Hosts + +- [Create](#hosts_create) +- [Delete](#hosts_delete) +- [GetByResourceGroup](#hosts_getbyresourcegroup) +- [List](#hosts_list) +- [ListByResourceGroup](#hosts_listbyresourcegroup) +- [Update](#hosts_update) + +## HybridIdentityMetadata + +- [Create](#hybrididentitymetadata_create) +- [Delete](#hybrididentitymetadata_delete) +- [Get](#hybrididentitymetadata_get) +- [ListByVm](#hybrididentitymetadata_listbyvm) + +## InventoryItems + +- [Create](#inventoryitems_create) +- [Delete](#inventoryitems_delete) +- [Get](#inventoryitems_get) +- [ListByVCenter](#inventoryitems_listbyvcenter) + +## MachineExtensions + +- [CreateOrUpdate](#machineextensions_createorupdate) +- [Delete](#machineextensions_delete) +- [Get](#machineextensions_get) +- [List](#machineextensions_list) +- [Update](#machineextensions_update) + +## Operations + +- [List](#operations_list) + +## ResourcePools + +- [Create](#resourcepools_create) +- [Delete](#resourcepools_delete) +- [GetByResourceGroup](#resourcepools_getbyresourcegroup) +- [List](#resourcepools_list) +- [ListByResourceGroup](#resourcepools_listbyresourcegroup) +- [Update](#resourcepools_update) + +## VCenters + +- [Create](#vcenters_create) +- [Delete](#vcenters_delete) +- [GetByResourceGroup](#vcenters_getbyresourcegroup) +- [List](#vcenters_list) +- [ListByResourceGroup](#vcenters_listbyresourcegroup) +- [Update](#vcenters_update) + +## VirtualMachineTemplates + +- [Create](#virtualmachinetemplates_create) +- [Delete](#virtualmachinetemplates_delete) +- [GetByResourceGroup](#virtualmachinetemplates_getbyresourcegroup) +- [List](#virtualmachinetemplates_list) +- [ListByResourceGroup](#virtualmachinetemplates_listbyresourcegroup) +- [Update](#virtualmachinetemplates_update) + +## VirtualMachines + +- [Create](#virtualmachines_create) +- [Delete](#virtualmachines_delete) +- [GetByResourceGroup](#virtualmachines_getbyresourcegroup) +- [List](#virtualmachines_list) +- [ListByResourceGroup](#virtualmachines_listbyresourcegroup) +- [Restart](#virtualmachines_restart) +- [Start](#virtualmachines_start) +- [Stop](#virtualmachines_stop) +- [Update](#virtualmachines_update) + +## VirtualNetworks + +- [Create](#virtualnetworks_create) +- [Delete](#virtualnetworks_delete) +- [GetByResourceGroup](#virtualnetworks_getbyresourcegroup) +- [List](#virtualnetworks_list) +- [ListByResourceGroup](#virtualnetworks_listbyresourcegroup) +- [Update](#virtualnetworks_update) +### Clusters_Create + +```java +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; + +/** Samples for Clusters Create. */ +public final class ClustersCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateCluster.json + */ + /** + * Sample code: CreateCluster. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createCluster(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager + .clusters() + .define("HRCluster") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso")) + .withVCenterId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter") + .withMoRefId("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .create(); + } +} +``` + +### Clusters_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Clusters Delete. */ +public final class ClustersDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteCluster.json + */ + /** + * Sample code: DeleteCluster. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteCluster(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.clusters().delete("testrg", "HRCluster", null, Context.NONE); + } +} +``` + +### Clusters_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Clusters GetByResourceGroup. */ +public final class ClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetCluster.json + */ + /** + * Sample code: GetCluster. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getCluster(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.clusters().getByResourceGroupWithResponse("testrg", "HRCluster", Context.NONE); + } +} +``` + +### Clusters_List + +```java +import com.azure.core.util.Context; + +/** Samples for Clusters List. */ +public final class ClustersListSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListClusters.json + */ + /** + * Sample code: ListClusters. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listClusters(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.clusters().list(Context.NONE); + } +} +``` + +### Clusters_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Clusters ListByResourceGroup. */ +public final class ClustersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListClustersByResourceGroup.json + */ + /** + * Sample code: ListClustersByResourceGroup. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listClustersByResourceGroup( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.clusters().listByResourceGroup("testrg", Context.NONE); + } +} +``` + +### Clusters_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.models.Cluster; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Clusters Update. */ +public final class ClustersUpdateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/UpdateCluster.json + */ + /** + * Sample code: UpdateCluster. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void updateCluster(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + Cluster resource = + manager.clusters().getByResourceGroupWithResponse("testrg", "HRCluster", 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; + } +} +``` + +### Datastores_Create + +```java +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; + +/** Samples for Datastores Create. */ +public final class DatastoresCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateDatastore.json + */ + /** + * Sample code: CreateDatastore. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createDatastore(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager + .datastores() + .define("HRDatastore") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso")) + .withVCenterId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter") + .withMoRefId("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .create(); + } +} +``` + +### Datastores_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Datastores Delete. */ +public final class DatastoresDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteDatastore.json + */ + /** + * Sample code: DeleteDatastore. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteDatastore(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.datastores().delete("testrg", "HRDatastore", null, Context.NONE); + } +} +``` + +### Datastores_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Datastores GetByResourceGroup. */ +public final class DatastoresGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetDatastore.json + */ + /** + * Sample code: GetDatastore. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getDatastore(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.datastores().getByResourceGroupWithResponse("testrg", "HRDatastore", Context.NONE); + } +} +``` + +### Datastores_List + +```java +import com.azure.core.util.Context; + +/** Samples for Datastores List. */ +public final class DatastoresListSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListDatastores.json + */ + /** + * Sample code: ListDatastores. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listDatastores(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.datastores().list(Context.NONE); + } +} +``` + +### Datastores_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Datastores ListByResourceGroup. */ +public final class DatastoresListByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListDatastoresByResourceGroup.json + */ + /** + * Sample code: ListDatastoresByResourceGroup. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listDatastoresByResourceGroup( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.datastores().listByResourceGroup("testrg", Context.NONE); + } +} +``` + +### Datastores_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.models.Datastore; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Datastores Update. */ +public final class DatastoresUpdateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/UpdateDatastore.json + */ + /** + * Sample code: UpdateDatastore. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void updateDatastore(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + Datastore resource = + manager.datastores().getByResourceGroupWithResponse("testrg", "HRDatastore", 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; + } +} +``` + +### GuestAgents_Create + +```java +import com.azure.resourcemanager.connectedvmware.models.GuestCredential; +import com.azure.resourcemanager.connectedvmware.models.HttpProxyConfiguration; +import com.azure.resourcemanager.connectedvmware.models.ProvisioningAction; + +/** Samples for GuestAgents Create. */ +public final class GuestAgentsCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateGuestAgent.json + */ + /** + * Sample code: CreateGuestAgent. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createGuestAgent(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager + .guestAgents() + .define("default") + .withExistingVirtualMachine("testrg", "ContosoVm") + .withCredentials(new GuestCredential().withUsername("tempuser").withPassword("")) + .withHttpProxyConfig(new HttpProxyConfiguration().withHttpsProxy("http://192.1.2.3:8080")) + .withProvisioningAction(ProvisioningAction.INSTALL) + .create(); + } +} +``` + +### GuestAgents_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for GuestAgents Delete. */ +public final class GuestAgentsDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteGuestAgent.json + */ + /** + * Sample code: DeleteGuestAgent. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteGuestAgent(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.guestAgents().delete("testrg", "ContosoVm", "default", Context.NONE); + } +} +``` + +### GuestAgents_Get + +```java +import com.azure.core.util.Context; + +/** Samples for GuestAgents Get. */ +public final class GuestAgentsGetSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetGuestAgent.json + */ + /** + * Sample code: GetGuestAgent. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getGuestAgent(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.guestAgents().getWithResponse("testrg", "ContosoVm", "default", Context.NONE); + } +} +``` + +### GuestAgents_ListByVm + +```java +import com.azure.core.util.Context; + +/** Samples for GuestAgents ListByVm. */ +public final class GuestAgentsListByVmSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GuestAgent_ListByVm.json + */ + /** + * Sample code: GuestAgentListByVm. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void guestAgentListByVm(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.guestAgents().listByVm("testrg", "ContosoVm", Context.NONE); + } +} +``` + +### Hosts_Create + +```java +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; + +/** Samples for Hosts Create. */ +public final class HostsCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateHost.json + */ + /** + * Sample code: CreateHost. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createHost(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager + .hosts() + .define("HRHost") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso")) + .withVCenterId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter") + .withMoRefId("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .create(); + } +} +``` + +### Hosts_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Hosts Delete. */ +public final class HostsDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteHost.json + */ + /** + * Sample code: DeleteHost. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteHost(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.hosts().delete("testrg", "HRHost", null, Context.NONE); + } +} +``` + +### Hosts_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Hosts GetByResourceGroup. */ +public final class HostsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetHost.json + */ + /** + * Sample code: GetHost. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getHost(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.hosts().getByResourceGroupWithResponse("testrg", "HRHost", Context.NONE); + } +} +``` + +### Hosts_List + +```java +import com.azure.core.util.Context; + +/** Samples for Hosts List. */ +public final class HostsListSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListHosts.json + */ + /** + * Sample code: ListHosts. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listHosts(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.hosts().list(Context.NONE); + } +} +``` + +### Hosts_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Hosts ListByResourceGroup. */ +public final class HostsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListHostsByResourceGroup.json + */ + /** + * Sample code: ListHostsByResourceGroup. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listHostsByResourceGroup( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.hosts().listByResourceGroup("testrg", Context.NONE); + } +} +``` + +### Hosts_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.models.HostModel; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Hosts Update. */ +public final class HostsUpdateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/UpdateHost.json + */ + /** + * Sample code: UpdateHost. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void updateHost(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + HostModel resource = + manager.hosts().getByResourceGroupWithResponse("testrg", "HRHost", 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; + } +} +``` + +### HybridIdentityMetadata_Create + +```java +/** Samples for HybridIdentityMetadata Create. */ +public final class HybridIdentityMetadataCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateHybridIdentityMetadata.json + */ + /** + * Sample code: CreateHybridIdentityMetadata. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createHybridIdentityMetadata( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager + .hybridIdentityMetadatas() + .define("default") + .withExistingVirtualMachine("testrg", "ContosoVm") + .withVmId("f8b82dff-38ef-4220-99ef-d3a3f86ddc6c") + .withPublicKey("8ec7d60c-9700-40b1-8e6e-e5b2f6f477f2") + .create(); + } +} +``` + +### HybridIdentityMetadata_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for HybridIdentityMetadata Delete. */ +public final class HybridIdentityMetadataDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteHybridIdentityMetadata.json + */ + /** + * Sample code: DeleteHybridIdentityMetadata. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteHybridIdentityMetadata( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.hybridIdentityMetadatas().deleteWithResponse("testrg", "ContosoVm", "default", Context.NONE); + } +} +``` + +### HybridIdentityMetadata_Get + +```java +import com.azure.core.util.Context; + +/** Samples for HybridIdentityMetadata Get. */ +public final class HybridIdentityMetadataGetSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetHybridIdentityMetadata.json + */ + /** + * Sample code: GetHybridIdentityMetadata. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getHybridIdentityMetadata( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.hybridIdentityMetadatas().getWithResponse("testrg", "ContosoVm", "default", Context.NONE); + } +} +``` + +### HybridIdentityMetadata_ListByVm + +```java +import com.azure.core.util.Context; + +/** Samples for HybridIdentityMetadata ListByVm. */ +public final class HybridIdentityMetadataListByVmSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/HybridIdentityMetadata_ListByVm.json + */ + /** + * Sample code: HybridIdentityMetadataListByVm. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void hybridIdentityMetadataListByVm( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.hybridIdentityMetadatas().listByVm("testrg", "ContosoVm", Context.NONE); + } +} +``` + +### InventoryItems_Create + +```java +/** Samples for InventoryItems Create. */ +public final class InventoryItemsCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateInventoryItem.json + */ + /** + * Sample code: CreateInventoryItem. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createInventoryItem(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.inventoryItems().define("testItem").withExistingVcenter("testrg", "ContosoVCenter").create(); + } +} +``` + +### InventoryItems_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for InventoryItems Delete. */ +public final class InventoryItemsDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteInventoryItem.json + */ + /** + * Sample code: DeleteInventoryItem. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteInventoryItem(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.inventoryItems().deleteWithResponse("testrg", "ContosoVCenter", "testItem", Context.NONE); + } +} +``` + +### InventoryItems_Get + +```java +import com.azure.core.util.Context; + +/** Samples for InventoryItems Get. */ +public final class InventoryItemsGetSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetInventoryItem.json + */ + /** + * Sample code: GetInventoryItem. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getInventoryItem(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.inventoryItems().getWithResponse("testrg", "ContosoVCenter", "testItem", Context.NONE); + } +} +``` + +### InventoryItems_ListByVCenter + +```java +import com.azure.core.util.Context; + +/** Samples for InventoryItems ListByVCenter. */ +public final class InventoryItemsListByVCenterSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/InventoryItems_ListByVCenter.json + */ + /** + * Sample code: InventoryItemsListByVCenter. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void inventoryItemsListByVCenter( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.inventoryItems().listByVCenter("testrg", "ContosoVCenter", Context.NONE); + } +} +``` + +### MachineExtensions_CreateOrUpdate + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import java.io.IOException; + +/** Samples for MachineExtensions CreateOrUpdate. */ +public final class MachineExtensionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/PUTExtension.json + */ + /** + * Sample code: Create or Update a Machine Extension (PUT). + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createOrUpdateAMachineExtensionPUT( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) throws IOException { + manager + .machineExtensions() + .define("CustomScriptExtension") + .withRegion("eastus2euap") + .withExistingVirtualMachine("myResourceGroup", "myMachine") + .withPublisher("Microsoft.Compute") + .withTypePropertiesType("CustomScriptExtension") + .withTypeHandlerVersion("1.10") + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"commandToExecute\":\"powershell.exe -c \\\"Get-Process | Where-Object { $_.CPU -gt 10000" + + " }\\\"\"}", + Object.class, + SerializerEncoding.JSON)) + .create(); + } +} +``` + +### MachineExtensions_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for MachineExtensions Delete. */ +public final class MachineExtensionsDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DELETEExtension.json + */ + /** + * Sample code: Delete a Machine Extension. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteAMachineExtension( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.machineExtensions().delete("myResourceGroup", "myMachine", "MMA", Context.NONE); + } +} +``` + +### MachineExtensions_Get + +```java +import com.azure.core.util.Context; + +/** Samples for MachineExtensions Get. */ +public final class MachineExtensionsGetSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GETExtension.json + */ + /** + * Sample code: Get Machine Extension. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getMachineExtension(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager + .machineExtensions() + .getWithResponse("myResourceGroup", "myMachine", "CustomScriptExtension", Context.NONE); + } +} +``` + +### MachineExtensions_List + +```java +import com.azure.core.util.Context; + +/** Samples for MachineExtensions List. */ +public final class MachineExtensionsListSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/LISTExtension.json + */ + /** + * Sample code: Get all Machine Extensions. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getAllMachineExtensions( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.machineExtensions().list("myResourceGroup", "myMachine", null, Context.NONE); + } +} +``` + +### MachineExtensions_Update + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.connectedvmware.models.MachineExtension; +import java.io.IOException; + +/** Samples for MachineExtensions Update. */ +public final class MachineExtensionsUpdateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/UpdateExtension.json + */ + /** + * Sample code: Create or Update a Machine Extension (PATCH). + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createOrUpdateAMachineExtensionPATCH( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) throws IOException { + MachineExtension resource = + manager + .machineExtensions() + .getWithResponse("myResourceGroup", "myMachine", "CustomScriptExtension", Context.NONE) + .getValue(); + resource + .update() + .withPublisher("Microsoft.Compute") + .withType("CustomScriptExtension") + .withTypeHandlerVersion("1.10") + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"commandToExecute\":\"powershell.exe -c \\\"Get-Process | Where-Object { $_.CPU -lt 100" + + " }\\\"\"}", + Object.class, + SerializerEncoding.JSON)) + .apply(); + } +} +``` + +### Operations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListOperations.json + */ + /** + * Sample code: ListOperations. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listOperations(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.operations().list(Context.NONE); + } +} +``` + +### ResourcePools_Create + +```java +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; + +/** Samples for ResourcePools Create. */ +public final class ResourcePoolsCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateResourcePool.json + */ + /** + * Sample code: CreateResourcePool. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createResourcePool(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager + .resourcePools() + .define("HRPool") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso")) + .withVCenterId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter") + .withMoRefId("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .create(); + } +} +``` + +### ResourcePools_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ResourcePools Delete. */ +public final class ResourcePoolsDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteResourcePool.json + */ + /** + * Sample code: DeleteResourcePool. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteResourcePool(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.resourcePools().delete("testrg", "HRPool", null, Context.NONE); + } +} +``` + +### ResourcePools_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for ResourcePools GetByResourceGroup. */ +public final class ResourcePoolsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetResourcePool.json + */ + /** + * Sample code: GetResourcePool. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getResourcePool(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.resourcePools().getByResourceGroupWithResponse("testrg", "HRPool", Context.NONE); + } +} +``` + +### ResourcePools_List + +```java +import com.azure.core.util.Context; + +/** Samples for ResourcePools List. */ +public final class ResourcePoolsListSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListResourcePools.json + */ + /** + * Sample code: ListResourcePools. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listResourcePools(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.resourcePools().list(Context.NONE); + } +} +``` + +### ResourcePools_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for ResourcePools ListByResourceGroup. */ +public final class ResourcePoolsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListResourcePoolsByResourceGroup.json + */ + /** + * Sample code: ListResourcePoolsByResourceGroup. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listResourcePoolsByResourceGroup( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.resourcePools().listByResourceGroup("testrg", Context.NONE); + } +} +``` + +### ResourcePools_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.models.ResourcePool; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ResourcePools Update. */ +public final class ResourcePoolsUpdateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/UpdateResourcePool.json + */ + /** + * Sample code: UpdateResourcePool. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void updateResourcePool(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + ResourcePool resource = + manager.resourcePools().getByResourceGroupWithResponse("testrg", "HRPool", 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; + } +} +``` + +### VCenters_Create + +```java +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; +import com.azure.resourcemanager.connectedvmware.models.VICredential; + +/** Samples for VCenters Create. */ +public final class VCentersCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateVCenter.json + */ + /** + * Sample code: CreateVCenter. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createVCenter(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager + .vCenters() + .define("ContosoVCenter") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withFqdn("ContosoVMware.contoso.com") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso")) + .withPort(1234) + .withCredentials(new VICredential().withUsername("tempuser").withPassword("")) + .create(); + } +} +``` + +### VCenters_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for VCenters Delete. */ +public final class VCentersDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteVCenter.json + */ + /** + * Sample code: DeleteVCenter. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteVCenter(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.vCenters().delete("testrg", "ContosoVCenter", null, Context.NONE); + } +} +``` + +### VCenters_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for VCenters GetByResourceGroup. */ +public final class VCentersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetVCenter.json + */ + /** + * Sample code: GetVCenter. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getVCenter(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.vCenters().getByResourceGroupWithResponse("testrg", "ContosoVCenter", Context.NONE); + } +} +``` + +### VCenters_List + +```java +import com.azure.core.util.Context; + +/** Samples for VCenters List. */ +public final class VCentersListSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListVCenters.json + */ + /** + * Sample code: ListVCenters. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listVCenters(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.vCenters().list(Context.NONE); + } +} +``` + +### VCenters_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for VCenters ListByResourceGroup. */ +public final class VCentersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListVCentersByResourceGroup.json + */ + /** + * Sample code: ListVCentersByResourceGroup. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listVCentersByResourceGroup( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.vCenters().listByResourceGroup("testrg", Context.NONE); + } +} +``` + +### VCenters_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.models.VCenter; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VCenters Update. */ +public final class VCentersUpdateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/UpdateVCenter.json + */ + /** + * Sample code: UpdateVCenter. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void updateVCenter(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + VCenter resource = + manager.vCenters().getByResourceGroupWithResponse("testrg", "ContosoVCenter", 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; + } +} +``` + +### VirtualMachineTemplates_Create + +```java +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; + +/** Samples for VirtualMachineTemplates Create. */ +public final class VirtualMachineTemplatesCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateVirtualMachineTemplate.json + */ + /** + * Sample code: CreateVirtualMachineTemplate. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createVirtualMachineTemplate( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager + .virtualMachineTemplates() + .define("WebFrontEndTemplate") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso")) + .withVCenterId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter") + .withMoRefId("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .create(); + } +} +``` + +### VirtualMachineTemplates_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineTemplates Delete. */ +public final class VirtualMachineTemplatesDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteVirtualMachineTemplate.json + */ + /** + * Sample code: DeleteVirtualMachineTemplate. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteVirtualMachineTemplate( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualMachineTemplates().delete("testrg", "WebFrontEndTemplate", 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetVirtualMachineTemplate.json + */ + /** + * Sample code: GetVirtualMachineTemplate. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getVirtualMachineTemplate( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualMachineTemplates().getByResourceGroupWithResponse("testrg", "WebFrontEndTemplate", Context.NONE); + } +} +``` + +### VirtualMachineTemplates_List + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachineTemplates List. */ +public final class VirtualMachineTemplatesListSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListVirtualMachineTemplates.json + */ + /** + * Sample code: ListVirtualMachineTemplates. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listVirtualMachineTemplates( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListVirtualMachineTemplatesByResourceGroup.json + */ + /** + * Sample code: ListVirtualMachineTemplatesByResourceGroup. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listVirtualMachineTemplatesByResourceGroup( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualMachineTemplates().listByResourceGroup("testrg", Context.NONE); + } +} +``` + +### VirtualMachineTemplates_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.models.VirtualMachineTemplate; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualMachineTemplates Update. */ +public final class VirtualMachineTemplatesUpdateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/UpdateVirtualMachineTemplate.json + */ + /** + * Sample code: UpdateVirtualMachineTemplate. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void updateVirtualMachineTemplate( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + VirtualMachineTemplate resource = + manager + .virtualMachineTemplates() + .getByResourceGroupWithResponse("testrg", "WebFrontEndTemplate", 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_Create + +```java +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; +import com.azure.resourcemanager.connectedvmware.models.HardwareProfile; + +/** Samples for VirtualMachines Create. */ +public final class VirtualMachinesCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateVirtualMachine.json + */ + /** + * Sample code: CreateVirtualMachine. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createVirtualMachine(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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.ExtendedLocation/customLocations/contoso")) + .withResourcePoolId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/ResourcePools/HRPool") + .withTemplateId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VirtualMachineTemplates/WebFrontEndTemplate") + .withVCenterId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter") + .withHardwareProfile(new HardwareProfile().withMemorySizeMB(4196).withNumCPUs(4)) + .create(); + } +} +``` + +### VirtualMachines_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Delete. */ +public final class VirtualMachinesDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteVirtualMachine.json + */ + /** + * Sample code: DeleteVirtualMachine. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteVirtualMachine(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualMachines().delete("testrg", "DemoVM", null, Context.NONE); + } +} +``` + +### VirtualMachines_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines GetByResourceGroup. */ +public final class VirtualMachinesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetVirtualMachine.json + */ + /** + * Sample code: GetVirtualMachine. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getVirtualMachine(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListVirtualMachines.json + */ + /** + * Sample code: ListVirtualMachines. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listVirtualMachines(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListVirtualMachinesByResourceGroup.json + */ + /** + * Sample code: ListVirtualMachinesByResourceGroup. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listVirtualMachinesByResourceGroup( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/RestartVirtualMachine.json + */ + /** + * Sample code: RestartVirtualMachine. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void restartVirtualMachine(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualMachines().restart("testrg", "DemoVM", Context.NONE); + } +} +``` + +### VirtualMachines_Start + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Start. */ +public final class VirtualMachinesStartSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/StartVirtualMachine.json + */ + /** + * Sample code: StartVirtualMachine. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void startVirtualMachine(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualMachines().start("testrg", "DemoVM", Context.NONE); + } +} +``` + +### VirtualMachines_Stop + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.models.StopVirtualMachineOptions; + +/** Samples for VirtualMachines Stop. */ +public final class VirtualMachinesStopSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/StopVirtualMachine.json + */ + /** + * Sample code: StopVirtualMachine. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void stopVirtualMachine(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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.connectedvmware.models.VirtualMachine; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualMachines Update. */ +public final class VirtualMachinesUpdateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/UpdateVirtualMachine.json + */ + /** + * Sample code: UpdateVirtualMachine. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void updateVirtualMachine(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + VirtualMachine resource = + manager.virtualMachines().getByResourceGroupWithResponse("testrg", "DemoVM", 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; + } +} +``` + +### VirtualNetworks_Create + +```java +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; + +/** Samples for VirtualNetworks Create. */ +public final class VirtualNetworksCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateVirtualNetwork.json + */ + /** + * Sample code: CreateVirtualNetwork. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createVirtualNetwork(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager + .virtualNetworks() + .define("ProdNetwork") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso")) + .withVCenterId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter") + .withMoRefId("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .create(); + } +} +``` + +### VirtualNetworks_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualNetworks Delete. */ +public final class VirtualNetworksDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteVirtualNetwork.json + */ + /** + * Sample code: DeleteVirtualNetwork. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteVirtualNetwork(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualNetworks().delete("testrg", "ProdNetwork", 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetVirtualNetwork.json + */ + /** + * Sample code: GetVirtualNetwork. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getVirtualNetwork(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualNetworks().getByResourceGroupWithResponse("testrg", "ProdNetwork", Context.NONE); + } +} +``` + +### VirtualNetworks_List + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualNetworks List. */ +public final class VirtualNetworksListSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListVirtualNetworks.json + */ + /** + * Sample code: ListVirtualNetworks. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listVirtualNetworks(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListVirtualNetworksByResourceGroup.json + */ + /** + * Sample code: ListVirtualNetworksByResourceGroup. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listVirtualNetworksByResourceGroup( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualNetworks().listByResourceGroup("testrg", Context.NONE); + } +} +``` + +### VirtualNetworks_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.models.VirtualNetwork; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualNetworks Update. */ +public final class VirtualNetworksUpdateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/UpdateVirtualNetwork.json + */ + /** + * Sample code: UpdateVirtualNetwork. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void updateVirtualNetwork(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + VirtualNetwork resource = + manager.virtualNetworks().getByResourceGroupWithResponse("testrg", "ProdNetwork", 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/connectedvmware/azure-resourcemanager-connectedvmware/pom.xml b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/pom.xml new file mode 100644 index 000000000000..45e09b6a985f --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/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-connectedvmware + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for ConnectedVMware Management + This package contains Microsoft Azure SDK for ConnectedVMware Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Connected VMware Client. Package tag package-2020-10-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + + + + com.azure + azure-core + 1.28.0 + + + com.azure + azure-core-management + 1.6.0 + + + diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/ConnectedVMwareManager.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/ConnectedVMwareManager.java new file mode 100644 index 000000000000..2717e6c33b8a --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/ConnectedVMwareManager.java @@ -0,0 +1,476 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware; + +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.connectedvmware.fluent.ConnectedVMwareClient; +import com.azure.resourcemanager.connectedvmware.implementation.ClustersImpl; +import com.azure.resourcemanager.connectedvmware.implementation.ConnectedVMwareClientBuilder; +import com.azure.resourcemanager.connectedvmware.implementation.DatastoresImpl; +import com.azure.resourcemanager.connectedvmware.implementation.GuestAgentsImpl; +import com.azure.resourcemanager.connectedvmware.implementation.HostsImpl; +import com.azure.resourcemanager.connectedvmware.implementation.HybridIdentityMetadatasImpl; +import com.azure.resourcemanager.connectedvmware.implementation.InventoryItemsImpl; +import com.azure.resourcemanager.connectedvmware.implementation.MachineExtensionsImpl; +import com.azure.resourcemanager.connectedvmware.implementation.OperationsImpl; +import com.azure.resourcemanager.connectedvmware.implementation.ResourcePoolsImpl; +import com.azure.resourcemanager.connectedvmware.implementation.VCentersImpl; +import com.azure.resourcemanager.connectedvmware.implementation.VirtualMachineTemplatesImpl; +import com.azure.resourcemanager.connectedvmware.implementation.VirtualMachinesImpl; +import com.azure.resourcemanager.connectedvmware.implementation.VirtualNetworksImpl; +import com.azure.resourcemanager.connectedvmware.models.Clusters; +import com.azure.resourcemanager.connectedvmware.models.Datastores; +import com.azure.resourcemanager.connectedvmware.models.GuestAgents; +import com.azure.resourcemanager.connectedvmware.models.Hosts; +import com.azure.resourcemanager.connectedvmware.models.HybridIdentityMetadatas; +import com.azure.resourcemanager.connectedvmware.models.InventoryItems; +import com.azure.resourcemanager.connectedvmware.models.MachineExtensions; +import com.azure.resourcemanager.connectedvmware.models.Operations; +import com.azure.resourcemanager.connectedvmware.models.ResourcePools; +import com.azure.resourcemanager.connectedvmware.models.VCenters; +import com.azure.resourcemanager.connectedvmware.models.VirtualMachineTemplates; +import com.azure.resourcemanager.connectedvmware.models.VirtualMachines; +import com.azure.resourcemanager.connectedvmware.models.VirtualNetworks; +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 ConnectedVMwareManager. Connected VMware Client. */ +public final class ConnectedVMwareManager { + private Operations operations; + + private ResourcePools resourcePools; + + private Clusters clusters; + + private Hosts hosts; + + private Datastores datastores; + + private VCenters vCenters; + + private VirtualMachines virtualMachines; + + private VirtualMachineTemplates virtualMachineTemplates; + + private VirtualNetworks virtualNetworks; + + private InventoryItems inventoryItems; + + private HybridIdentityMetadatas hybridIdentityMetadatas; + + private MachineExtensions machineExtensions; + + private GuestAgents guestAgents; + + private final ConnectedVMwareClient clientObject; + + private ConnectedVMwareManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new ConnectedVMwareClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of ConnectedVMware service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ConnectedVMware service API instance. + */ + public static ConnectedVMwareManager 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 ConnectedVMware service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the ConnectedVMware service API instance. + */ + public static ConnectedVMwareManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ConnectedVMwareManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ConnectedVMwareManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ConnectedVMwareManager.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 ConnectedVMware service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ConnectedVMware service API instance. + */ + public ConnectedVMwareManager 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.connectedvmware") + .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 ConnectedVMwareManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of ResourcePools. + * + * @return Resource collection API of ResourcePools. + */ + public ResourcePools resourcePools() { + if (this.resourcePools == null) { + this.resourcePools = new ResourcePoolsImpl(clientObject.getResourcePools(), this); + } + return resourcePools; + } + + /** + * Gets the resource collection API of Clusters. + * + * @return Resource collection API of Clusters. + */ + public Clusters clusters() { + if (this.clusters == null) { + this.clusters = new ClustersImpl(clientObject.getClusters(), this); + } + return clusters; + } + + /** + * Gets the resource collection API of Hosts. + * + * @return Resource collection API of Hosts. + */ + public Hosts hosts() { + if (this.hosts == null) { + this.hosts = new HostsImpl(clientObject.getHosts(), this); + } + return hosts; + } + + /** + * Gets the resource collection API of Datastores. + * + * @return Resource collection API of Datastores. + */ + public Datastores datastores() { + if (this.datastores == null) { + this.datastores = new DatastoresImpl(clientObject.getDatastores(), this); + } + return datastores; + } + + /** + * Gets the resource collection API of VCenters. + * + * @return Resource collection API of VCenters. + */ + public VCenters vCenters() { + if (this.vCenters == null) { + this.vCenters = new VCentersImpl(clientObject.getVCenters(), this); + } + return vCenters; + } + + /** + * Gets the resource collection API of VirtualMachines. + * + * @return Resource collection API of VirtualMachines. + */ + public VirtualMachines virtualMachines() { + if (this.virtualMachines == null) { + this.virtualMachines = new VirtualMachinesImpl(clientObject.getVirtualMachines(), this); + } + return virtualMachines; + } + + /** + * Gets the resource collection API of VirtualMachineTemplates. + * + * @return Resource collection API of VirtualMachineTemplates. + */ + public VirtualMachineTemplates virtualMachineTemplates() { + if (this.virtualMachineTemplates == null) { + this.virtualMachineTemplates = + new VirtualMachineTemplatesImpl(clientObject.getVirtualMachineTemplates(), this); + } + return virtualMachineTemplates; + } + + /** + * Gets the resource collection API of VirtualNetworks. + * + * @return Resource collection API of VirtualNetworks. + */ + public VirtualNetworks virtualNetworks() { + if (this.virtualNetworks == null) { + this.virtualNetworks = new VirtualNetworksImpl(clientObject.getVirtualNetworks(), this); + } + return virtualNetworks; + } + + /** + * Gets the resource collection API of InventoryItems. + * + * @return Resource collection API of InventoryItems. + */ + public InventoryItems inventoryItems() { + if (this.inventoryItems == null) { + this.inventoryItems = new InventoryItemsImpl(clientObject.getInventoryItems(), this); + } + return inventoryItems; + } + + /** + * Gets the resource collection API of HybridIdentityMetadatas. + * + * @return Resource collection API of HybridIdentityMetadatas. + */ + public HybridIdentityMetadatas hybridIdentityMetadatas() { + if (this.hybridIdentityMetadatas == null) { + this.hybridIdentityMetadatas = + new HybridIdentityMetadatasImpl(clientObject.getHybridIdentityMetadatas(), this); + } + return hybridIdentityMetadatas; + } + + /** + * Gets the resource collection API of MachineExtensions. + * + * @return Resource collection API of MachineExtensions. + */ + public MachineExtensions machineExtensions() { + if (this.machineExtensions == null) { + this.machineExtensions = new MachineExtensionsImpl(clientObject.getMachineExtensions(), this); + } + return machineExtensions; + } + + /** + * Gets the resource collection API of GuestAgents. + * + * @return Resource collection API of GuestAgents. + */ + public GuestAgents guestAgents() { + if (this.guestAgents == null) { + this.guestAgents = new GuestAgentsImpl(clientObject.getGuestAgents(), this); + } + return guestAgents; + } + + /** + * @return Wrapped service client ConnectedVMwareClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public ConnectedVMwareClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/ClustersClient.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/ClustersClient.java new file mode 100644 index 000000000000..54c835b33962 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/ClustersClient.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.models.ClusterInner; +import com.azure.resourcemanager.connectedvmware.models.ResourcePatch; + +/** An instance of this class provides access to all the operations defined in ClustersClient. */ +public interface ClustersClient { + /** + * Create Or Update cluster. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @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 define the cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ClusterInner> beginCreate( + String resourceGroupName, String clusterName, ClusterInner body); + + /** + * Create Or Update cluster. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @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 define the cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ClusterInner> beginCreate( + String resourceGroupName, String clusterName, ClusterInner body, Context context); + + /** + * Create Or Update cluster. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @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 define the cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterInner create(String resourceGroupName, String clusterName, ClusterInner body); + + /** + * Create Or Update cluster. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterInner create(String resourceGroupName, String clusterName); + + /** + * Create Or Update cluster. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @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 define the cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterInner create(String resourceGroupName, String clusterName, ClusterInner body, Context context); + + /** + * Implements cluster GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterInner getByResourceGroup(String resourceGroupName, String clusterName); + + /** + * Implements cluster GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the cluster along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String clusterName, Context context); + + /** + * API to update certain properties of the cluster resource. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ClusterInner update(String resourceGroupName, String clusterName); + + /** + * API to update certain properties of the cluster resource. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the cluster along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String clusterName, ResourcePatch body, Context context); + + /** + * Implements cluster DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 clusterName, Boolean force); + + /** + * Implements cluster DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 clusterName, Boolean force, Context context); + + /** + * Implements cluster DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName, Boolean force); + + /** + * Implements cluster DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName); + + /** + * Implements cluster DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName, Boolean force, Context context); + + /** + * List of clusters 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 Clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List of clusters 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 Clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List of clusters in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of clusters in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/ConnectedVMwareClient.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/ConnectedVMwareClient.java new file mode 100644 index 000000000000..5f85407c48fa --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/ConnectedVMwareClient.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.connectedvmware.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for ConnectedVMwareClient class. */ +public interface ConnectedVMwareClient { + /** + * Gets The Subscription ID. + * + * @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 OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the ResourcePoolsClient object to access its operations. + * + * @return the ResourcePoolsClient object. + */ + ResourcePoolsClient getResourcePools(); + + /** + * Gets the ClustersClient object to access its operations. + * + * @return the ClustersClient object. + */ + ClustersClient getClusters(); + + /** + * Gets the HostsClient object to access its operations. + * + * @return the HostsClient object. + */ + HostsClient getHosts(); + + /** + * Gets the DatastoresClient object to access its operations. + * + * @return the DatastoresClient object. + */ + DatastoresClient getDatastores(); + + /** + * Gets the VCentersClient object to access its operations. + * + * @return the VCentersClient object. + */ + VCentersClient getVCenters(); + + /** + * 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 VirtualNetworksClient object to access its operations. + * + * @return the VirtualNetworksClient object. + */ + VirtualNetworksClient getVirtualNetworks(); + + /** + * Gets the InventoryItemsClient object to access its operations. + * + * @return the InventoryItemsClient object. + */ + InventoryItemsClient getInventoryItems(); + + /** + * Gets the HybridIdentityMetadatasClient object to access its operations. + * + * @return the HybridIdentityMetadatasClient object. + */ + HybridIdentityMetadatasClient getHybridIdentityMetadatas(); + + /** + * Gets the MachineExtensionsClient object to access its operations. + * + * @return the MachineExtensionsClient object. + */ + MachineExtensionsClient getMachineExtensions(); + + /** + * Gets the GuestAgentsClient object to access its operations. + * + * @return the GuestAgentsClient object. + */ + GuestAgentsClient getGuestAgents(); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/DatastoresClient.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/DatastoresClient.java new file mode 100644 index 000000000000..13feebd20da7 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/DatastoresClient.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.models.DatastoreInner; +import com.azure.resourcemanager.connectedvmware.models.ResourcePatch; + +/** An instance of this class provides access to all the operations defined in DatastoresClient. */ +public interface DatastoresClient { + /** + * Create Or Update datastore. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @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 define the datastore. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DatastoreInner> beginCreate( + String resourceGroupName, String datastoreName, DatastoreInner body); + + /** + * Create Or Update datastore. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @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 define the datastore. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DatastoreInner> beginCreate( + String resourceGroupName, String datastoreName, DatastoreInner body, Context context); + + /** + * Create Or Update datastore. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @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 define the datastore. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatastoreInner create(String resourceGroupName, String datastoreName, DatastoreInner body); + + /** + * Create Or Update datastore. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the datastore. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatastoreInner create(String resourceGroupName, String datastoreName); + + /** + * Create Or Update datastore. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @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 define the datastore. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatastoreInner create(String resourceGroupName, String datastoreName, DatastoreInner body, Context context); + + /** + * Implements datastore GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the datastore. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatastoreInner getByResourceGroup(String resourceGroupName, String datastoreName); + + /** + * Implements datastore GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the datastore along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String datastoreName, Context context); + + /** + * API to update certain properties of the datastore resource. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the datastore. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatastoreInner update(String resourceGroupName, String datastoreName); + + /** + * API to update certain properties of the datastore resource. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the datastore along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String datastoreName, ResourcePatch body, Context context); + + /** + * Implements datastore DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 datastoreName, Boolean force); + + /** + * Implements datastore DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 datastoreName, Boolean force, Context context); + + /** + * Implements datastore DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 datastoreName, Boolean force); + + /** + * Implements datastore DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 datastoreName); + + /** + * Implements datastore DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 datastoreName, Boolean force, Context context); + + /** + * List of datastores 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 Datastores as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List of datastores 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 Datastores as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List of datastores in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Datastores as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of datastores in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Datastores as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/GuestAgentsClient.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/GuestAgentsClient.java new file mode 100644 index 000000000000..5a59a834bc65 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/GuestAgentsClient.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.models.GuestAgentInner; + +/** An instance of this class provides access to all the operations defined in GuestAgentsClient. */ +public interface GuestAgentsClient { + /** + * Create Or Update GuestAgent. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the guestAgents. + * @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 defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GuestAgentInner> beginCreate( + String resourceGroupName, String virtualMachineName, String name, GuestAgentInner body); + + /** + * Create Or Update GuestAgent. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the guestAgents. + * @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 defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GuestAgentInner> beginCreate( + String resourceGroupName, String virtualMachineName, String name, GuestAgentInner body, Context context); + + /** + * Create Or Update GuestAgent. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the guestAgents. + * @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 defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GuestAgentInner create(String resourceGroupName, String virtualMachineName, String name, GuestAgentInner body); + + /** + * Create Or Update GuestAgent. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the guestAgents. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GuestAgentInner create(String resourceGroupName, String virtualMachineName, String name); + + /** + * Create Or Update GuestAgent. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the guestAgents. + * @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 GuestAgent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GuestAgentInner create( + String resourceGroupName, String virtualMachineName, String name, GuestAgentInner body, Context context); + + /** + * Implements GuestAgent GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GuestAgentInner get(String resourceGroupName, String virtualMachineName, String name); + + /** + * Implements GuestAgent GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the GuestAgent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String virtualMachineName, String name, Context context); + + /** + * Implements GuestAgent DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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, String name); + + /** + * Implements GuestAgent DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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, String name, Context context); + + /** + * Implements GuestAgent DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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, String name); + + /** + * Implements GuestAgent DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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, String name, Context context); + + /** + * Returns the list of GuestAgent of the given vm. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 GuestAgent as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByVm(String resourceGroupName, String virtualMachineName); + + /** + * Returns the list of GuestAgent of the given vm. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 GuestAgent as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByVm(String resourceGroupName, String virtualMachineName, Context context); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/HostsClient.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/HostsClient.java new file mode 100644 index 000000000000..7cb61265d45e --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/HostsClient.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.models.HostModelInner; +import com.azure.resourcemanager.connectedvmware.models.ResourcePatch; + +/** An instance of this class provides access to all the operations defined in HostsClient. */ +public interface HostsClient { + /** + * Create Or Update host. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @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 define the host. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, HostModelInner> beginCreate( + String resourceGroupName, String hostname, HostModelInner body); + + /** + * Create Or Update host. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @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 define the host. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, HostModelInner> beginCreate( + String resourceGroupName, String hostname, HostModelInner body, Context context); + + /** + * Create Or Update host. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @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 define the host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HostModelInner create(String resourceGroupName, String hostname, HostModelInner body); + + /** + * Create Or Update host. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HostModelInner create(String resourceGroupName, String hostname); + + /** + * Create Or Update host. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @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 define the host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HostModelInner create(String resourceGroupName, String hostname, HostModelInner body, Context context); + + /** + * Implements host GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HostModelInner getByResourceGroup(String resourceGroupName, String hostname); + + /** + * Implements host GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the host along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String hostname, Context context); + + /** + * API to update certain properties of the host resource. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HostModelInner update(String resourceGroupName, String hostname); + + /** + * API to update certain properties of the host resource. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the host along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String hostname, ResourcePatch body, Context context); + + /** + * Implements host DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 hostname, Boolean force); + + /** + * Implements host DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 hostname, Boolean force, Context context); + + /** + * Implements host DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 hostname, Boolean force); + + /** + * Implements host DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 hostname); + + /** + * Implements host DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 hostname, Boolean force, Context context); + + /** + * List of hosts 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 Hosts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List of hosts 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 Hosts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List of hosts in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Hosts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of hosts in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Hosts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/HybridIdentityMetadatasClient.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/HybridIdentityMetadatasClient.java new file mode 100644 index 000000000000..e45b16a29dec --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/HybridIdentityMetadatasClient.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.connectedvmware.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.connectedvmware.fluent.models.HybridIdentityMetadataInner; + +/** An instance of this class provides access to all the operations defined in HybridIdentityMetadatasClient. */ +public interface HybridIdentityMetadatasClient { + /** + * Create Or Update HybridIdentityMetadata. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the hybridIdentityMetadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the HybridIdentityMetadata. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HybridIdentityMetadataInner create(String resourceGroupName, String virtualMachineName, String metadataName); + + /** + * Create Or Update HybridIdentityMetadata. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the hybridIdentityMetadata. + * @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 HybridIdentityMetadata along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String virtualMachineName, + String metadataName, + HybridIdentityMetadataInner body, + Context context); + + /** + * Implements HybridIdentityMetadata GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the HybridIdentityMetadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the HybridIdentityMetadata. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HybridIdentityMetadataInner get(String resourceGroupName, String virtualMachineName, String metadataName); + + /** + * Implements HybridIdentityMetadata GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the HybridIdentityMetadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the HybridIdentityMetadata along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String virtualMachineName, String metadataName, Context context); + + /** + * Implements HybridIdentityMetadata DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the HybridIdentityMetadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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, String metadataName); + + /** + * Implements HybridIdentityMetadata DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the HybridIdentityMetadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 virtualMachineName, String metadataName, Context context); + + /** + * Returns the list of HybridIdentityMetadata of the given vm. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 HybridIdentityMetadata as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByVm(String resourceGroupName, String virtualMachineName); + + /** + * Returns the list of HybridIdentityMetadata of the given vm. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 HybridIdentityMetadata as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByVm( + String resourceGroupName, String virtualMachineName, Context context); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/InventoryItemsClient.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/InventoryItemsClient.java new file mode 100644 index 000000000000..472e28873c47 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.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.connectedvmware.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 Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, String inventoryItemName); + + /** + * Create Or Update InventoryItem. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, + String inventoryItemName, + InventoryItemInner body, + Context context); + + /** + * Implements InventoryItem GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, String inventoryItemName); + + /** + * Implements InventoryItem GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, String inventoryItemName, Context context); + + /** + * Implements inventoryItem DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, String inventoryItemName); + + /** + * Implements inventoryItem DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, String inventoryItemName, Context context); + + /** + * Returns the list of inventoryItems of the given vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 listByVCenter(String resourceGroupName, String vcenterName); + + /** + * Returns the list of inventoryItems of the given vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 listByVCenter(String resourceGroupName, String vcenterName, Context context); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/MachineExtensionsClient.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/MachineExtensionsClient.java new file mode 100644 index 000000000000..c691bacf7cc1 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/MachineExtensionsClient.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.models.MachineExtensionInner; +import com.azure.resourcemanager.connectedvmware.models.MachineExtensionUpdate; + +/** An instance of this class provides access to all the operations defined in MachineExtensionsClient. */ +public interface MachineExtensionsClient { + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MachineExtensionInner> beginCreateOrUpdate( + String resourceGroupName, String name, String extensionName, MachineExtensionInner extensionParameters); + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MachineExtensionInner> beginCreateOrUpdate( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionInner extensionParameters, + Context context); + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MachineExtensionInner createOrUpdate( + String resourceGroupName, String name, String extensionName, MachineExtensionInner extensionParameters); + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MachineExtensionInner createOrUpdate( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionInner extensionParameters, + Context context); + + /** + * The operation to update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MachineExtensionInner> beginUpdate( + String resourceGroupName, String name, String extensionName, MachineExtensionUpdate extensionParameters); + + /** + * The operation to update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MachineExtensionInner> beginUpdate( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionUpdate extensionParameters, + Context context); + + /** + * The operation to update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MachineExtensionInner update( + String resourceGroupName, String name, String extensionName, MachineExtensionUpdate extensionParameters); + + /** + * The operation to update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MachineExtensionInner update( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionUpdate extensionParameters, + Context context); + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 name, String extensionName); + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 name, String extensionName, Context context); + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 name, String extensionName); + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 name, String extensionName, Context context); + + /** + * The operation to get the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine containing the extension. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MachineExtensionInner get(String resourceGroupName, String name, String extensionName); + + /** + * The operation to get the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine containing the extension. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String name, String extensionName, Context context); + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine containing the extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the Machine Extensions List Result as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String name); + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the Machine Extensions List Result as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String name, String expand, Context context); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/OperationsClient.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/OperationsClient.java new file mode 100644 index 000000000000..d9ef668266b0 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.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.connectedvmware.fluent.models.OperationInner; + +/** 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 lists the operations available 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 lists the operations available as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/ResourcePoolsClient.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/ResourcePoolsClient.java new file mode 100644 index 000000000000..76b2a598008d --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/ResourcePoolsClient.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.models.ResourcePoolInner; +import com.azure.resourcemanager.connectedvmware.models.ResourcePatch; + +/** An instance of this class provides access to all the operations defined in ResourcePoolsClient. */ +public interface ResourcePoolsClient { + /** + * Create Or Update resourcePool. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @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 define the resourcePool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ResourcePoolInner> beginCreate( + String resourceGroupName, String resourcePoolName, ResourcePoolInner body); + + /** + * Create Or Update resourcePool. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @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 define the resourcePool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ResourcePoolInner> beginCreate( + String resourceGroupName, String resourcePoolName, ResourcePoolInner body, Context context); + + /** + * Create Or Update resourcePool. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @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 define the resourcePool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourcePoolInner create(String resourceGroupName, String resourcePoolName, ResourcePoolInner body); + + /** + * Create Or Update resourcePool. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the resourcePool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourcePoolInner create(String resourceGroupName, String resourcePoolName); + + /** + * Create Or Update resourcePool. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @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 define the resourcePool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourcePoolInner create( + String resourceGroupName, String resourcePoolName, ResourcePoolInner body, Context context); + + /** + * Implements resourcePool GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the resourcePool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourcePoolInner getByResourceGroup(String resourceGroupName, String resourcePoolName); + + /** + * Implements resourcePool GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the resourcePool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String resourcePoolName, Context context); + + /** + * API to update certain properties of the resourcePool resource. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the resourcePool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourcePoolInner update(String resourceGroupName, String resourcePoolName); + + /** + * API to update certain properties of the resourcePool resource. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the resourcePool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String resourcePoolName, ResourcePatch body, Context context); + + /** + * Implements resourcePool DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 resourcePoolName, Boolean force); + + /** + * Implements resourcePool DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 resourcePoolName, Boolean force, Context context); + + /** + * Implements resourcePool DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 resourcePoolName, Boolean force); + + /** + * Implements resourcePool DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 resourcePoolName); + + /** + * Implements resourcePool DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 resourcePoolName, Boolean force, Context context); + + /** + * List of resourcePools 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 ResourcePools as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List of resourcePools 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 ResourcePools as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List of resourcePools in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 ResourcePools as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of resourcePools in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 ResourcePools as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/VCentersClient.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/VCentersClient.java new file mode 100644 index 000000000000..224232ea48c6 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/VCentersClient.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.models.VCenterInner; +import com.azure.resourcemanager.connectedvmware.models.ResourcePatch; + +/** An instance of this class provides access to all the operations defined in VCentersClient. */ +public interface VCentersClient { + /** + * Create Or Update vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 defines the vCenter. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VCenterInner> beginCreate( + String resourceGroupName, String vcenterName, VCenterInner body); + + /** + * Create Or Update vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 defines the vCenter. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VCenterInner> beginCreate( + String resourceGroupName, String vcenterName, VCenterInner body, Context context); + + /** + * Create Or Update vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 defines the vCenter. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VCenterInner create(String resourceGroupName, String vcenterName, VCenterInner body); + + /** + * Create Or Update vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 vCenter. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VCenterInner create(String resourceGroupName, String vcenterName); + + /** + * Create Or Update vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vCenter. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VCenterInner create(String resourceGroupName, String vcenterName, VCenterInner body, Context context); + + /** + * Implements vCenter GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 vCenter. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VCenterInner getByResourceGroup(String resourceGroupName, String vcenterName); + + /** + * Implements vCenter GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 vCenter along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String vcenterName, Context context); + + /** + * API to update certain properties of the vCenter resource. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 vCenter. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VCenterInner update(String resourceGroupName, String vcenterName); + + /** + * API to update certain properties of the vCenter resource. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 vCenter along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String vcenterName, ResourcePatch body, Context context); + + /** + * Implements vCenter DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 vcenterName, Boolean force); + + /** + * Implements vCenter DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 vcenterName, Boolean force, Context context); + + /** + * Implements vCenter DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 vcenterName, Boolean force); + + /** + * Implements vCenter DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 vcenterName); + + /** + * Implements vCenter DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 vcenterName, Boolean force, Context context); + + /** + * List of vCenters 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 VCenters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List of vCenters 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 VCenters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List of vCenters in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 VCenters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of vCenters in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 VCenters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/VirtualMachineTemplatesClient.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/VirtualMachineTemplatesClient.java new file mode 100644 index 000000000000..b1aa4cfe16d7 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/VirtualMachineTemplatesClient.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.models.VirtualMachineTemplateInner; +import com.azure.resourcemanager.connectedvmware.models.ResourcePatch; + +/** An instance of this class provides access to all the operations defined in VirtualMachineTemplatesClient. */ +public interface VirtualMachineTemplatesClient { + /** + * Create Or Update virtual machine template. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @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 define the virtualMachineTemplate. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineTemplateInner> beginCreate( + String resourceGroupName, String virtualMachineTemplateName, VirtualMachineTemplateInner body); + + /** + * Create Or Update virtual machine template. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @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 define the virtualMachineTemplate. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineTemplateInner> beginCreate( + String resourceGroupName, String virtualMachineTemplateName, VirtualMachineTemplateInner body, Context context); + + /** + * Create Or Update virtual machine template. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @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 define the virtualMachineTemplate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineTemplateInner create( + String resourceGroupName, String virtualMachineTemplateName, VirtualMachineTemplateInner body); + + /** + * Create Or Update virtual machine template. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachineTemplate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineTemplateInner create(String resourceGroupName, String virtualMachineTemplateName); + + /** + * Create Or Update virtual machine template. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @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 define the virtualMachineTemplate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineTemplateInner create( + String resourceGroupName, String virtualMachineTemplateName, VirtualMachineTemplateInner body, Context context); + + /** + * Implements virtual machine template GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachineTemplate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineTemplateInner getByResourceGroup(String resourceGroupName, String virtualMachineTemplateName); + + /** + * Implements virtual machine template GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachineTemplate along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualMachineTemplateName, Context context); + + /** + * API to update certain properties of the virtual machine template resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachineTemplate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineTemplateInner update(String resourceGroupName, String virtualMachineTemplateName); + + /** + * API to update certain properties of the virtual machine template resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachineTemplate along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String virtualMachineTemplateName, ResourcePatch body, Context context); + + /** + * Implements virtual machine template DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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); + + /** + * Implements virtual machine template DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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); + + /** + * Implements virtual machine template DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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); + + /** + * Implements virtual machine template DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String virtualMachineTemplateName); + + /** + * Implements virtual machine template DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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); + + /** + * 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); + + /** + * List of virtualMachineTemplates in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/VirtualMachinesClient.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/VirtualMachinesClient.java new file mode 100644 index 000000000000..4bf94d6ff8eb --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/VirtualMachinesClient.java @@ -0,0 +1,486 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.models.VirtualMachineInner; +import com.azure.resourcemanager.connectedvmware.models.StopVirtualMachineOptions; +import com.azure.resourcemanager.connectedvmware.models.VirtualMachineUpdate; + +/** An instance of this class provides access to all the operations defined in VirtualMachinesClient. */ +public interface VirtualMachinesClient { + /** + * Create Or Update virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineInner> beginCreate( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body); + + /** + * Create Or Update virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineInner> beginCreate( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body, Context context); + + /** + * Create Or Update virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInner create(String resourceGroupName, String virtualMachineName, VirtualMachineInner body); + + /** + * Create Or Update virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInner create(String resourceGroupName, String virtualMachineName); + + /** + * Create Or Update virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInner create( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body, Context context); + + /** + * Implements virtual machine GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInner getByResourceGroup(String resourceGroupName, String virtualMachineName); + + /** + * Implements virtual machine GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualMachineName, Context context); + + /** + * API to update certain properties of the virtual machine resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param body Resource properties to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineInner> beginUpdate( + String resourceGroupName, String virtualMachineName, VirtualMachineUpdate body); + + /** + * API to update certain properties of the virtual machine resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineInner> beginUpdate( + String resourceGroupName, String virtualMachineName, VirtualMachineUpdate body, Context context); + + /** + * API to update certain properties of the virtual machine resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param body Resource properties to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInner update(String resourceGroupName, String virtualMachineName, VirtualMachineUpdate body); + + /** + * API to update certain properties of the virtual machine resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInner update(String resourceGroupName, String virtualMachineName); + + /** + * API to update certain properties of the virtual machine resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInner update( + String resourceGroupName, String virtualMachineName, VirtualMachineUpdate body, Context context); + + /** + * Implements virtual machine DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 force); + + /** + * Implements virtual machine DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 force, Context context); + + /** + * Implements virtual machine DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 force); + + /** + * Implements virtual machine DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String virtualMachineName); + + /** + * Implements virtual machine DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 force, Context context); + + /** + * Stop virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void stop(String resourceGroupName, String virtualMachineName); + + /** + * Stop virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart(String resourceGroupName, String virtualMachineName); + + /** + * Start virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart(String resourceGroupName, String virtualMachineName, Context context); + + /** + * Start virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void start(String resourceGroupName, String virtualMachineName); + + /** + * Start virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void start(String resourceGroupName, String virtualMachineName, Context context); + + /** + * Restart virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart(String resourceGroupName, String virtualMachineName); + + /** + * Restart virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart( + String resourceGroupName, String virtualMachineName, Context context); + + /** + * Restart virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void restart(String resourceGroupName, String virtualMachineName); + + /** + * Restart virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void restart(String resourceGroupName, String virtualMachineName, 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); + + /** + * List of virtualMachines in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/VirtualNetworksClient.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/VirtualNetworksClient.java new file mode 100644 index 000000000000..3c3dc4c29521 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/VirtualNetworksClient.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.models.VirtualNetworkInner; +import com.azure.resourcemanager.connectedvmware.models.ResourcePatch; + +/** An instance of this class provides access to all the operations defined in VirtualNetworksClient. */ +public interface VirtualNetworksClient { + /** + * Create Or Update virtual network. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @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 define the virtualNetwork. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualNetworkInner> beginCreate( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body); + + /** + * Create Or Update virtual network. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @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 define the virtualNetwork. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualNetworkInner> beginCreate( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body, Context context); + + /** + * Create Or Update virtual network. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @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 define the virtualNetwork. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkInner create(String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body); + + /** + * Create Or Update virtual network. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualNetwork. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkInner create(String resourceGroupName, String virtualNetworkName); + + /** + * Create Or Update virtual network. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @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 define the virtualNetwork. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkInner create( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body, Context context); + + /** + * Implements virtual network GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualNetwork. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkInner getByResourceGroup(String resourceGroupName, String virtualNetworkName); + + /** + * Implements virtual network GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualNetwork along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualNetworkName, Context context); + + /** + * API to update certain properties of the virtual network resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualNetwork. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkInner update(String resourceGroupName, String virtualNetworkName); + + /** + * API to update certain properties of the virtual network resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualNetwork along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String virtualNetworkName, ResourcePatch body, Context context); + + /** + * Implements virtual network DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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); + + /** + * Implements virtual network DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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); + + /** + * Implements virtual network DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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); + + /** + * Implements virtual network DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String virtualNetworkName); + + /** + * Implements virtual network DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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); + + /** + * 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); + + /** + * List of virtualNetworks in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/ClusterInner.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/ClusterInner.java new file mode 100644 index 000000000000..b944222cb685 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/ClusterInner.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.models.ExtendedLocation; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Define the cluster. */ +@Fluent +public final class ClusterInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties", required = true) + private ClusterProperties innerProperties = new ClusterProperties(); + + /* + * Gets or sets the extended location. + */ + @JsonProperty(value = "extendedLocation") + private ExtendedLocation extendedLocation; + + /* + * 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 ClusterProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the extendedLocation property: Gets or sets the extended location. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: Gets or sets the extended location. + * + * @param extendedLocation the extendedLocation value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** + * 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 ClusterInner object itself. + */ + public ClusterInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** {@inheritDoc} */ + @Override + public ClusterInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ClusterInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + public String uuid() { + return this.innerProperties() == null ? null : this.innerProperties().uuid(); + } + + /** + * Get the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this cluster resides. + * + * @return the vCenterId value. + */ + public String vCenterId() { + return this.innerProperties() == null ? null : this.innerProperties().vCenterId(); + } + + /** + * Set the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this cluster resides. + * + * @param vCenterId the vCenterId value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withVCenterId(String vCenterId) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withVCenterId(vCenterId); + return this; + } + + /** + * Get the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the cluster. + * + * @return the moRefId value. + */ + public String moRefId() { + return this.innerProperties() == null ? null : this.innerProperties().moRefId(); + } + + /** + * Set the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the cluster. + * + * @param moRefId the moRefId value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withMoRefId(String moRefId) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withMoRefId(moRefId); + return this; + } + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the cluster. + * + * @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 cluster. + * + * @param inventoryItemId the inventoryItemId value to set. + * @return the ClusterInner object itself. + */ + public ClusterInner withInventoryItemId(String inventoryItemId) { + if (this.innerProperties() == null) { + this.innerProperties = new ClusterProperties(); + } + this.innerProperties().withInventoryItemId(inventoryItemId); + return this; + } + + /** + * Get the moName property: Gets or sets the vCenter Managed Object name for the cluster. + * + * @return the moName value. + */ + public String moName() { + return this.innerProperties() == null ? null : this.innerProperties().moName(); + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.innerProperties() == null ? null : this.innerProperties().statuses(); + } + + /** + * Get the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + public String customResourceName() { + return this.innerProperties() == null ? null : this.innerProperties().customResourceName(); + } + + /** + * Get the datastoreIds property: Gets or sets the datastore ARM ids. + * + * @return the datastoreIds value. + */ + public List datastoreIds() { + return this.innerProperties() == null ? null : this.innerProperties().datastoreIds(); + } + + /** + * Get the networkIds property: Gets or sets the network ARM ids. + * + * @return the networkIds value. + */ + public List networkIds() { + return this.innerProperties() == null ? null : this.innerProperties().networkIds(); + } + + /** + * 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 ClusterInner")); + } else { + innerProperties().validate(); + } + if (extendedLocation() != null) { + extendedLocation().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ClusterInner.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/ClusterProperties.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/ClusterProperties.java new file mode 100644 index 000000000000..f2ac28258763 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/ClusterProperties.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Defines the resource properties. */ +@Fluent +public final class ClusterProperties { + /* + * Gets or sets a unique identifier for this resource. + */ + @JsonProperty(value = "uuid", access = JsonProperty.Access.WRITE_ONLY) + private String uuid; + + /* + * Gets or sets the ARM Id of the vCenter resource in which this cluster + * resides. + */ + @JsonProperty(value = "vCenterId") + private String vCenterId; + + /* + * Gets or sets the vCenter MoRef (Managed Object Reference) ID for the + * cluster. + */ + @JsonProperty(value = "moRefId") + private String moRefId; + + /* + * Gets or sets the inventory Item ID for the cluster. + */ + @JsonProperty(value = "inventoryItemId") + private String inventoryItemId; + + /* + * Gets or sets the vCenter Managed Object name for the cluster. + */ + @JsonProperty(value = "moName", access = JsonProperty.Access.WRITE_ONLY) + private String moName; + + /* + * The resource status information. + */ + @JsonProperty(value = "statuses", access = JsonProperty.Access.WRITE_ONLY) + private List statuses; + + /* + * Gets the name of the corresponding resource in Kubernetes. + */ + @JsonProperty(value = "customResourceName", access = JsonProperty.Access.WRITE_ONLY) + private String customResourceName; + + /* + * Gets or sets the datastore ARM ids. + */ + @JsonProperty(value = "datastoreIds", access = JsonProperty.Access.WRITE_ONLY) + private List datastoreIds; + + /* + * Gets or sets the network ARM ids. + */ + @JsonProperty(value = "networkIds", access = JsonProperty.Access.WRITE_ONLY) + private List networkIds; + + /* + * Gets or sets the provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + public String uuid() { + return this.uuid; + } + + /** + * Get the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this cluster resides. + * + * @return the vCenterId value. + */ + public String vCenterId() { + return this.vCenterId; + } + + /** + * Set the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this cluster resides. + * + * @param vCenterId the vCenterId value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withVCenterId(String vCenterId) { + this.vCenterId = vCenterId; + return this; + } + + /** + * Get the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the cluster. + * + * @return the moRefId value. + */ + public String moRefId() { + return this.moRefId; + } + + /** + * Set the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the cluster. + * + * @param moRefId the moRefId value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withMoRefId(String moRefId) { + this.moRefId = moRefId; + return this; + } + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the cluster. + * + * @return the inventoryItemId value. + */ + public String inventoryItemId() { + return this.inventoryItemId; + } + + /** + * Set the inventoryItemId property: Gets or sets the inventory Item ID for the cluster. + * + * @param inventoryItemId the inventoryItemId value to set. + * @return the ClusterProperties object itself. + */ + public ClusterProperties withInventoryItemId(String inventoryItemId) { + this.inventoryItemId = inventoryItemId; + return this; + } + + /** + * Get the moName property: Gets or sets the vCenter Managed Object name for the cluster. + * + * @return the moName value. + */ + public String moName() { + return this.moName; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * Get the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + public String customResourceName() { + return this.customResourceName; + } + + /** + * Get the datastoreIds property: Gets or sets the datastore ARM ids. + * + * @return the datastoreIds value. + */ + public List datastoreIds() { + return this.datastoreIds; + } + + /** + * Get the networkIds property: Gets or sets the network ARM ids. + * + * @return the networkIds value. + */ + public List networkIds() { + return this.networkIds; + } + + /** + * 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 (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/DatastoreInner.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/DatastoreInner.java new file mode 100644 index 000000000000..fc0d5139724c --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/DatastoreInner.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.models.ExtendedLocation; +import com.azure.resourcemanager.connectedvmware.models.ProvisioningState; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Define the datastore. */ +@Fluent +public final class DatastoreInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties", required = true) + private DatastoreProperties innerProperties = new DatastoreProperties(); + + /* + * Gets or sets the extended location. + */ + @JsonProperty(value = "extendedLocation") + private ExtendedLocation extendedLocation; + + /* + * 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 DatastoreProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the extendedLocation property: Gets or sets the extended location. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: Gets or sets the extended location. + * + * @param extendedLocation the extendedLocation value to set. + * @return the DatastoreInner object itself. + */ + public DatastoreInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** + * 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 DatastoreInner object itself. + */ + public DatastoreInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** {@inheritDoc} */ + @Override + public DatastoreInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DatastoreInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + public String uuid() { + return this.innerProperties() == null ? null : this.innerProperties().uuid(); + } + + /** + * Get the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this datastore resides. + * + * @return the vCenterId value. + */ + public String vCenterId() { + return this.innerProperties() == null ? null : this.innerProperties().vCenterId(); + } + + /** + * Set the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this datastore resides. + * + * @param vCenterId the vCenterId value to set. + * @return the DatastoreInner object itself. + */ + public DatastoreInner withVCenterId(String vCenterId) { + if (this.innerProperties() == null) { + this.innerProperties = new DatastoreProperties(); + } + this.innerProperties().withVCenterId(vCenterId); + return this; + } + + /** + * Get the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the datastore. + * + * @return the moRefId value. + */ + public String moRefId() { + return this.innerProperties() == null ? null : this.innerProperties().moRefId(); + } + + /** + * Set the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the datastore. + * + * @param moRefId the moRefId value to set. + * @return the DatastoreInner object itself. + */ + public DatastoreInner withMoRefId(String moRefId) { + if (this.innerProperties() == null) { + this.innerProperties = new DatastoreProperties(); + } + this.innerProperties().withMoRefId(moRefId); + return this; + } + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the datastore. + * + * @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 datastore. + * + * @param inventoryItemId the inventoryItemId value to set. + * @return the DatastoreInner object itself. + */ + public DatastoreInner withInventoryItemId(String inventoryItemId) { + if (this.innerProperties() == null) { + this.innerProperties = new DatastoreProperties(); + } + this.innerProperties().withInventoryItemId(inventoryItemId); + return this; + } + + /** + * Get the moName property: Gets or sets the vCenter Managed Object name for the datastore. + * + * @return the moName value. + */ + public String moName() { + return this.innerProperties() == null ? null : this.innerProperties().moName(); + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.innerProperties() == null ? null : this.innerProperties().statuses(); + } + + /** + * Get the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + public String customResourceName() { + return this.innerProperties() == null ? null : this.innerProperties().customResourceName(); + } + + /** + * Get the provisioningState property: Provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property innerProperties in model DatastoreInner")); + } else { + innerProperties().validate(); + } + if (extendedLocation() != null) { + extendedLocation().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DatastoreInner.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/DatastoreProperties.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/DatastoreProperties.java new file mode 100644 index 000000000000..5c901bda14e6 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/DatastoreProperties.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.models.ProvisioningState; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Defines the resource properties. */ +@Fluent +public final class DatastoreProperties { + /* + * Gets or sets a unique identifier for this resource. + */ + @JsonProperty(value = "uuid", access = JsonProperty.Access.WRITE_ONLY) + private String uuid; + + /* + * Gets or sets the ARM Id of the vCenter resource in which this datastore + * resides. + */ + @JsonProperty(value = "vCenterId") + private String vCenterId; + + /* + * Gets or sets the vCenter MoRef (Managed Object Reference) ID for the + * datastore. + */ + @JsonProperty(value = "moRefId") + private String moRefId; + + /* + * Gets or sets the inventory Item ID for the datastore. + */ + @JsonProperty(value = "inventoryItemId") + private String inventoryItemId; + + /* + * Gets or sets the vCenter Managed Object name for the datastore. + */ + @JsonProperty(value = "moName", access = JsonProperty.Access.WRITE_ONLY) + private String moName; + + /* + * The resource status information. + */ + @JsonProperty(value = "statuses", access = JsonProperty.Access.WRITE_ONLY) + private List statuses; + + /* + * Gets the name of the corresponding resource in Kubernetes. + */ + @JsonProperty(value = "customResourceName", access = JsonProperty.Access.WRITE_ONLY) + private String customResourceName; + + /* + * Provisioning state of the resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + public String uuid() { + return this.uuid; + } + + /** + * Get the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this datastore resides. + * + * @return the vCenterId value. + */ + public String vCenterId() { + return this.vCenterId; + } + + /** + * Set the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this datastore resides. + * + * @param vCenterId the vCenterId value to set. + * @return the DatastoreProperties object itself. + */ + public DatastoreProperties withVCenterId(String vCenterId) { + this.vCenterId = vCenterId; + return this; + } + + /** + * Get the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the datastore. + * + * @return the moRefId value. + */ + public String moRefId() { + return this.moRefId; + } + + /** + * Set the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the datastore. + * + * @param moRefId the moRefId value to set. + * @return the DatastoreProperties object itself. + */ + public DatastoreProperties withMoRefId(String moRefId) { + this.moRefId = moRefId; + return this; + } + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the datastore. + * + * @return the inventoryItemId value. + */ + public String inventoryItemId() { + return this.inventoryItemId; + } + + /** + * Set the inventoryItemId property: Gets or sets the inventory Item ID for the datastore. + * + * @param inventoryItemId the inventoryItemId value to set. + * @return the DatastoreProperties object itself. + */ + public DatastoreProperties withInventoryItemId(String inventoryItemId) { + this.inventoryItemId = inventoryItemId; + return this; + } + + /** + * Get the moName property: Gets or sets the vCenter Managed Object name for the datastore. + * + * @return the moName value. + */ + public String moName() { + return this.moName; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * Get the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + public String customResourceName() { + return this.customResourceName; + } + + /** + * Get the provisioningState property: Provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/GuestAgentInner.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/GuestAgentInner.java new file mode 100644 index 000000000000..3d9b35d9e49a --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/GuestAgentInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.azure.resourcemanager.connectedvmware.models.GuestCredential; +import com.azure.resourcemanager.connectedvmware.models.HttpProxyConfiguration; +import com.azure.resourcemanager.connectedvmware.models.ProvisioningAction; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Defines the GuestAgent. */ +@Fluent +public final class GuestAgentInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties", required = true) + private GuestAgentProperties innerProperties = new GuestAgentProperties(); + + /* + * The system data. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private GuestAgentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: The system data. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + public String uuid() { + return this.innerProperties() == null ? null : this.innerProperties().uuid(); + } + + /** + * Get the credentials property: Username / Password Credentials to provision guest agent. + * + * @return the credentials value. + */ + public GuestCredential credentials() { + return this.innerProperties() == null ? null : this.innerProperties().credentials(); + } + + /** + * Set the credentials property: Username / Password Credentials to provision guest agent. + * + * @param credentials the credentials value to set. + * @return the GuestAgentInner object itself. + */ + public GuestAgentInner withCredentials(GuestCredential credentials) { + if (this.innerProperties() == null) { + this.innerProperties = new GuestAgentProperties(); + } + this.innerProperties().withCredentials(credentials); + return this; + } + + /** + * Get the httpProxyConfig property: HTTP Proxy configuration for the VM. + * + * @return the httpProxyConfig value. + */ + public HttpProxyConfiguration httpProxyConfig() { + return this.innerProperties() == null ? null : this.innerProperties().httpProxyConfig(); + } + + /** + * Set the httpProxyConfig property: HTTP Proxy configuration for the VM. + * + * @param httpProxyConfig the httpProxyConfig value to set. + * @return the GuestAgentInner object itself. + */ + public GuestAgentInner withHttpProxyConfig(HttpProxyConfiguration httpProxyConfig) { + if (this.innerProperties() == null) { + this.innerProperties = new GuestAgentProperties(); + } + this.innerProperties().withHttpProxyConfig(httpProxyConfig); + return this; + } + + /** + * Get the provisioningAction property: Gets or sets the guest agent provisioning action. + * + * @return the provisioningAction value. + */ + public ProvisioningAction provisioningAction() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningAction(); + } + + /** + * Set the provisioningAction property: Gets or sets the guest agent provisioning action. + * + * @param provisioningAction the provisioningAction value to set. + * @return the GuestAgentInner object itself. + */ + public GuestAgentInner withProvisioningAction(ProvisioningAction provisioningAction) { + if (this.innerProperties() == null) { + this.innerProperties = new GuestAgentProperties(); + } + this.innerProperties().withProvisioningAction(provisioningAction); + return this; + } + + /** + * Get the status property: Gets or sets the guest agent status. + * + * @return the status value. + */ + public String status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + public String customResourceName() { + return this.innerProperties() == null ? null : this.innerProperties().customResourceName(); + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.innerProperties() == null ? null : this.innerProperties().statuses(); + } + + /** + * 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 GuestAgentInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GuestAgentInner.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/GuestAgentProperties.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/GuestAgentProperties.java new file mode 100644 index 000000000000..2198f627b8e1 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/GuestAgentProperties.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.models.GuestCredential; +import com.azure.resourcemanager.connectedvmware.models.HttpProxyConfiguration; +import com.azure.resourcemanager.connectedvmware.models.ProvisioningAction; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Defines the resource properties. */ +@Fluent +public final class GuestAgentProperties { + /* + * Gets or sets a unique identifier for this resource. + */ + @JsonProperty(value = "uuid", access = JsonProperty.Access.WRITE_ONLY) + private String uuid; + + /* + * Username / Password Credentials to provision guest agent. + */ + @JsonProperty(value = "credentials") + private GuestCredential credentials; + + /* + * HTTP Proxy configuration for the VM. + */ + @JsonProperty(value = "httpProxyConfig") + private HttpProxyConfiguration httpProxyConfig; + + /* + * Gets or sets the guest agent provisioning action. + */ + @JsonProperty(value = "provisioningAction") + private ProvisioningAction provisioningAction; + + /* + * Gets or sets the guest agent status. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * Gets the name of the corresponding resource in Kubernetes. + */ + @JsonProperty(value = "customResourceName", access = JsonProperty.Access.WRITE_ONLY) + private String customResourceName; + + /* + * The resource status information. + */ + @JsonProperty(value = "statuses", access = JsonProperty.Access.WRITE_ONLY) + private List statuses; + + /* + * Gets or sets the provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + public String uuid() { + return this.uuid; + } + + /** + * Get the credentials property: Username / Password Credentials to provision guest agent. + * + * @return the credentials value. + */ + public GuestCredential credentials() { + return this.credentials; + } + + /** + * Set the credentials property: Username / Password Credentials to provision guest agent. + * + * @param credentials the credentials value to set. + * @return the GuestAgentProperties object itself. + */ + public GuestAgentProperties withCredentials(GuestCredential credentials) { + this.credentials = credentials; + return this; + } + + /** + * Get the httpProxyConfig property: HTTP Proxy configuration for the VM. + * + * @return the httpProxyConfig value. + */ + public HttpProxyConfiguration httpProxyConfig() { + return this.httpProxyConfig; + } + + /** + * Set the httpProxyConfig property: HTTP Proxy configuration for the VM. + * + * @param httpProxyConfig the httpProxyConfig value to set. + * @return the GuestAgentProperties object itself. + */ + public GuestAgentProperties withHttpProxyConfig(HttpProxyConfiguration httpProxyConfig) { + this.httpProxyConfig = httpProxyConfig; + return this; + } + + /** + * Get the provisioningAction property: Gets or sets the guest agent provisioning action. + * + * @return the provisioningAction value. + */ + public ProvisioningAction provisioningAction() { + return this.provisioningAction; + } + + /** + * Set the provisioningAction property: Gets or sets the guest agent provisioning action. + * + * @param provisioningAction the provisioningAction value to set. + * @return the GuestAgentProperties object itself. + */ + public GuestAgentProperties withProvisioningAction(ProvisioningAction provisioningAction) { + this.provisioningAction = provisioningAction; + return this; + } + + /** + * Get the status property: Gets or sets the guest agent status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + public String customResourceName() { + return this.customResourceName; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * 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 (httpProxyConfig() != null) { + httpProxyConfig().validate(); + } + if (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/HostModelInner.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/HostModelInner.java new file mode 100644 index 000000000000..f9f915fa4898 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/HostModelInner.java @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.models.ExtendedLocation; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Define the host. */ +@Fluent +public final class HostModelInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties", required = true) + private HostProperties innerProperties = new HostProperties(); + + /* + * Gets or sets the extended location. + */ + @JsonProperty(value = "extendedLocation") + private ExtendedLocation extendedLocation; + + /* + * 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 HostProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the extendedLocation property: Gets or sets the extended location. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: Gets or sets the extended location. + * + * @param extendedLocation the extendedLocation value to set. + * @return the HostModelInner object itself. + */ + public HostModelInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** + * 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 HostModelInner object itself. + */ + public HostModelInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** {@inheritDoc} */ + @Override + public HostModelInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public HostModelInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + public String uuid() { + return this.innerProperties() == null ? null : this.innerProperties().uuid(); + } + + /** + * Get the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this host resides. + * + * @return the vCenterId value. + */ + public String vCenterId() { + return this.innerProperties() == null ? null : this.innerProperties().vCenterId(); + } + + /** + * Set the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this host resides. + * + * @param vCenterId the vCenterId value to set. + * @return the HostModelInner object itself. + */ + public HostModelInner withVCenterId(String vCenterId) { + if (this.innerProperties() == null) { + this.innerProperties = new HostProperties(); + } + this.innerProperties().withVCenterId(vCenterId); + return this; + } + + /** + * Get the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the host. + * + * @return the moRefId value. + */ + public String moRefId() { + return this.innerProperties() == null ? null : this.innerProperties().moRefId(); + } + + /** + * Set the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the host. + * + * @param moRefId the moRefId value to set. + * @return the HostModelInner object itself. + */ + public HostModelInner withMoRefId(String moRefId) { + if (this.innerProperties() == null) { + this.innerProperties = new HostProperties(); + } + this.innerProperties().withMoRefId(moRefId); + return this; + } + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the host. + * + * @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 host. + * + * @param inventoryItemId the inventoryItemId value to set. + * @return the HostModelInner object itself. + */ + public HostModelInner withInventoryItemId(String inventoryItemId) { + if (this.innerProperties() == null) { + this.innerProperties = new HostProperties(); + } + this.innerProperties().withInventoryItemId(inventoryItemId); + return this; + } + + /** + * Get the moName property: Gets or sets the vCenter Managed Object name for the host. + * + * @return the moName value. + */ + public String moName() { + return this.innerProperties() == null ? null : this.innerProperties().moName(); + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.innerProperties() == null ? null : this.innerProperties().statuses(); + } + + /** + * Get the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + public String customResourceName() { + return this.innerProperties() == null ? null : this.innerProperties().customResourceName(); + } + + /** + * 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 HostModelInner")); + } else { + innerProperties().validate(); + } + if (extendedLocation() != null) { + extendedLocation().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HostModelInner.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/HostProperties.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/HostProperties.java new file mode 100644 index 000000000000..c509df53f099 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/HostProperties.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Defines the resource properties. */ +@Fluent +public final class HostProperties { + /* + * Gets or sets a unique identifier for this resource. + */ + @JsonProperty(value = "uuid", access = JsonProperty.Access.WRITE_ONLY) + private String uuid; + + /* + * Gets or sets the ARM Id of the vCenter resource in which this host + * resides. + */ + @JsonProperty(value = "vCenterId") + private String vCenterId; + + /* + * Gets or sets the vCenter MoRef (Managed Object Reference) ID for the + * host. + */ + @JsonProperty(value = "moRefId") + private String moRefId; + + /* + * Gets or sets the inventory Item ID for the host. + */ + @JsonProperty(value = "inventoryItemId") + private String inventoryItemId; + + /* + * Gets or sets the vCenter Managed Object name for the host. + */ + @JsonProperty(value = "moName", access = JsonProperty.Access.WRITE_ONLY) + private String moName; + + /* + * The resource status information. + */ + @JsonProperty(value = "statuses", access = JsonProperty.Access.WRITE_ONLY) + private List statuses; + + /* + * Gets the name of the corresponding resource in Kubernetes. + */ + @JsonProperty(value = "customResourceName", access = JsonProperty.Access.WRITE_ONLY) + private String customResourceName; + + /* + * Gets or sets the provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + public String uuid() { + return this.uuid; + } + + /** + * Get the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this host resides. + * + * @return the vCenterId value. + */ + public String vCenterId() { + return this.vCenterId; + } + + /** + * Set the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this host resides. + * + * @param vCenterId the vCenterId value to set. + * @return the HostProperties object itself. + */ + public HostProperties withVCenterId(String vCenterId) { + this.vCenterId = vCenterId; + return this; + } + + /** + * Get the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the host. + * + * @return the moRefId value. + */ + public String moRefId() { + return this.moRefId; + } + + /** + * Set the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the host. + * + * @param moRefId the moRefId value to set. + * @return the HostProperties object itself. + */ + public HostProperties withMoRefId(String moRefId) { + this.moRefId = moRefId; + return this; + } + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the host. + * + * @return the inventoryItemId value. + */ + public String inventoryItemId() { + return this.inventoryItemId; + } + + /** + * Set the inventoryItemId property: Gets or sets the inventory Item ID for the host. + * + * @param inventoryItemId the inventoryItemId value to set. + * @return the HostProperties object itself. + */ + public HostProperties withInventoryItemId(String inventoryItemId) { + this.inventoryItemId = inventoryItemId; + return this; + } + + /** + * Get the moName property: Gets or sets the vCenter Managed Object name for the host. + * + * @return the moName value. + */ + public String moName() { + return this.moName; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * Get the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + public String customResourceName() { + return this.customResourceName; + } + + /** + * 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 (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/HybridIdentityMetadataInner.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/HybridIdentityMetadataInner.java new file mode 100644 index 000000000000..61ad1b6f5ad6 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/HybridIdentityMetadataInner.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.connectedvmware.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.azure.resourcemanager.connectedvmware.models.Identity; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the HybridIdentityMetadata. */ +@Fluent +public final class HybridIdentityMetadataInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties", required = true) + private HybridIdentityMetadataProperties innerProperties = new HybridIdentityMetadataProperties(); + + /* + * The system data. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private HybridIdentityMetadataProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: The system data. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the vmId property: Gets or sets the Vm Id. + * + * @return the vmId value. + */ + public String vmId() { + return this.innerProperties() == null ? null : this.innerProperties().vmId(); + } + + /** + * Set the vmId property: Gets or sets the Vm Id. + * + * @param vmId the vmId value to set. + * @return the HybridIdentityMetadataInner object itself. + */ + public HybridIdentityMetadataInner withVmId(String vmId) { + if (this.innerProperties() == null) { + this.innerProperties = new HybridIdentityMetadataProperties(); + } + this.innerProperties().withVmId(vmId); + return this; + } + + /** + * Get the publicKey property: Gets or sets the Public Key. + * + * @return the publicKey value. + */ + public String publicKey() { + return this.innerProperties() == null ? null : this.innerProperties().publicKey(); + } + + /** + * Set the publicKey property: Gets or sets the Public Key. + * + * @param publicKey the publicKey value to set. + * @return the HybridIdentityMetadataInner object itself. + */ + public HybridIdentityMetadataInner withPublicKey(String publicKey) { + if (this.innerProperties() == null) { + this.innerProperties = new HybridIdentityMetadataProperties(); + } + this.innerProperties().withPublicKey(publicKey); + return this; + } + + /** + * Get the identity property: The identity of the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.innerProperties() == null ? null : this.innerProperties().identity(); + } + + /** + * 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 HybridIdentityMetadataInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HybridIdentityMetadataInner.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/HybridIdentityMetadataProperties.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/HybridIdentityMetadataProperties.java new file mode 100644 index 000000000000..cc1501d8c867 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/HybridIdentityMetadataProperties.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.models.Identity; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the resource properties. */ +@Fluent +public final class HybridIdentityMetadataProperties { + /* + * Gets or sets the Vm Id. + */ + @JsonProperty(value = "vmId") + private String vmId; + + /* + * Gets or sets the Public Key. + */ + @JsonProperty(value = "publicKey") + private String publicKey; + + /* + * The identity of the resource. + */ + @JsonProperty(value = "identity", access = JsonProperty.Access.WRITE_ONLY) + private Identity identity; + + /* + * Gets or sets the provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the vmId property: Gets or sets the Vm Id. + * + * @return the vmId value. + */ + public String vmId() { + return this.vmId; + } + + /** + * Set the vmId property: Gets or sets the Vm Id. + * + * @param vmId the vmId value to set. + * @return the HybridIdentityMetadataProperties object itself. + */ + public HybridIdentityMetadataProperties withVmId(String vmId) { + this.vmId = vmId; + return this; + } + + /** + * Get the publicKey property: Gets or sets the Public Key. + * + * @return the publicKey value. + */ + public String publicKey() { + return this.publicKey; + } + + /** + * Set the publicKey property: Gets or sets the Public Key. + * + * @param publicKey the publicKey value to set. + * @return the HybridIdentityMetadataProperties object itself. + */ + public HybridIdentityMetadataProperties withPublicKey(String publicKey) { + this.publicKey = publicKey; + return this; + } + + /** + * Get the identity property: The identity of the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * 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 (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/InventoryItemInner.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/InventoryItemInner.java new file mode 100644 index 000000000000..1165191abc97 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/InventoryItemInner.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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 or sets the tracked resource id corresponding to the inventory resource. + * + * @return the managedResourceId value. + */ + public String managedResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().managedResourceId(); + } + + /** + * Set the managedResourceId property: Gets or sets the tracked resource id corresponding to the inventory resource. + * + * @param managedResourceId the managedResourceId value to set. + * @return the InventoryItemInner object itself. + */ + public InventoryItemInner withManagedResourceId(String managedResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new InventoryItemProperties(); + } + this.innerProperties().withManagedResourceId(managedResourceId); + return this; + } + + /** + * Get the moRefId property: Gets or sets the MoRef (Managed Object Reference) ID for the inventory item. + * + * @return the moRefId value. + */ + public String moRefId() { + return this.innerProperties() == null ? null : this.innerProperties().moRefId(); + } + + /** + * Set the moRefId property: Gets or sets the MoRef (Managed Object Reference) ID for the inventory item. + * + * @param moRefId the moRefId value to set. + * @return the InventoryItemInner object itself. + */ + public InventoryItemInner withMoRefId(String moRefId) { + if (this.innerProperties() == null) { + this.innerProperties = new InventoryItemProperties(); + } + this.innerProperties().withMoRefId(moRefId); + return this; + } + + /** + * Get the moName property: Gets or sets the vCenter Managed Object name for the inventory item. + * + * @return the moName value. + */ + public String moName() { + return this.innerProperties() == null ? null : this.innerProperties().moName(); + } + + /** + * Set the moName property: Gets or sets the vCenter Managed Object name for the inventory item. + * + * @param moName the moName value to set. + * @return the InventoryItemInner object itself. + */ + public InventoryItemInner withMoName(String moName) { + if (this.innerProperties() == null) { + this.innerProperties = new InventoryItemProperties(); + } + this.innerProperties().withMoName(moName); + 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) { + 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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/InventoryItemProperties.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/InventoryItemProperties.java new file mode 100644 index 000000000000..090513caa471 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/InventoryItemProperties.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.models.ClusterInventoryItem; +import com.azure.resourcemanager.connectedvmware.models.DatastoreInventoryItem; +import com.azure.resourcemanager.connectedvmware.models.HostInventoryItem; +import com.azure.resourcemanager.connectedvmware.models.ResourcePoolInventoryItem; +import com.azure.resourcemanager.connectedvmware.models.VirtualMachineInventoryItem; +import com.azure.resourcemanager.connectedvmware.models.VirtualMachineTemplateInventoryItem; +import com.azure.resourcemanager.connectedvmware.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 = "ResourcePool", value = ResourcePoolInventoryItem.class), + @JsonSubTypes.Type(name = "VirtualMachine", value = VirtualMachineInventoryItem.class), + @JsonSubTypes.Type(name = "VirtualMachineTemplate", value = VirtualMachineTemplateInventoryItem.class), + @JsonSubTypes.Type(name = "VirtualNetwork", value = VirtualNetworkInventoryItem.class), + @JsonSubTypes.Type(name = "Cluster", value = ClusterInventoryItem.class), + @JsonSubTypes.Type(name = "Datastore", value = DatastoreInventoryItem.class), + @JsonSubTypes.Type(name = "Host", value = HostInventoryItem.class) +}) +@Fluent +public class InventoryItemProperties { + /* + * Gets or sets the tracked resource id corresponding to the inventory + * resource. + */ + @JsonProperty(value = "managedResourceId") + private String managedResourceId; + + /* + * Gets or sets the MoRef (Managed Object Reference) ID for the inventory + * item. + */ + @JsonProperty(value = "moRefId") + private String moRefId; + + /* + * Gets or sets the vCenter Managed Object name for the inventory item. + */ + @JsonProperty(value = "moName") + private String moName; + + /* + * Gets or sets the provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the managedResourceId property: Gets or sets the tracked resource id corresponding to the inventory resource. + * + * @return the managedResourceId value. + */ + public String managedResourceId() { + return this.managedResourceId; + } + + /** + * Set the managedResourceId property: Gets or sets the tracked resource id corresponding to the inventory resource. + * + * @param managedResourceId the managedResourceId value to set. + * @return the InventoryItemProperties object itself. + */ + public InventoryItemProperties withManagedResourceId(String managedResourceId) { + this.managedResourceId = managedResourceId; + return this; + } + + /** + * Get the moRefId property: Gets or sets the MoRef (Managed Object Reference) ID for the inventory item. + * + * @return the moRefId value. + */ + public String moRefId() { + return this.moRefId; + } + + /** + * Set the moRefId property: Gets or sets the MoRef (Managed Object Reference) ID for the inventory item. + * + * @param moRefId the moRefId value to set. + * @return the InventoryItemProperties object itself. + */ + public InventoryItemProperties withMoRefId(String moRefId) { + this.moRefId = moRefId; + return this; + } + + /** + * Get the moName property: Gets or sets the vCenter Managed Object name for the inventory item. + * + * @return the moName value. + */ + public String moName() { + return this.moName; + } + + /** + * Set the moName property: Gets or sets the vCenter Managed Object name for the inventory item. + * + * @param moName the moName value to set. + * @return the InventoryItemProperties object itself. + */ + public InventoryItemProperties withMoName(String moName) { + this.moName = moName; + 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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/MachineExtensionInner.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/MachineExtensionInner.java new file mode 100644 index 000000000000..88144ff49a5c --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/MachineExtensionInner.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.connectedvmware.models.MachineExtensionPropertiesInstanceView; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Describes a Machine Extension. */ +@Fluent +public final class MachineExtensionInner extends Resource { + /* + * Describes Machine Extension Properties. + */ + @JsonProperty(value = "properties") + private MachineExtensionProperties innerProperties; + + /* + * The system data. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: Describes Machine Extension Properties. + * + * @return the innerProperties value. + */ + private MachineExtensionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: The system data. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public MachineExtensionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public MachineExtensionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.innerProperties() == null ? null : this.innerProperties().forceUpdateTag(); + } + + /** + * Set the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the MachineExtensionInner object itself. + */ + public MachineExtensionInner withForceUpdateTag(String forceUpdateTag) { + if (this.innerProperties() == null) { + this.innerProperties = new MachineExtensionProperties(); + } + this.innerProperties().withForceUpdateTag(forceUpdateTag); + return this; + } + + /** + * Get the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.innerProperties() == null ? null : this.innerProperties().publisher(); + } + + /** + * Set the publisher property: The name of the extension handler publisher. + * + * @param publisher the publisher value to set. + * @return the MachineExtensionInner object itself. + */ + public MachineExtensionInner withPublisher(String publisher) { + if (this.innerProperties() == null) { + this.innerProperties = new MachineExtensionProperties(); + } + this.innerProperties().withPublisher(publisher); + return this; + } + + /** + * Get the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the type value. + */ + public String typePropertiesType() { + return this.innerProperties() == null ? null : this.innerProperties().type(); + } + + /** + * Set the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @param type the type value to set. + * @return the MachineExtensionInner object itself. + */ + public MachineExtensionInner withTypePropertiesType(String type) { + if (this.innerProperties() == null) { + this.innerProperties = new MachineExtensionProperties(); + } + this.innerProperties().withType(type); + return this; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.innerProperties() == null ? null : this.innerProperties().typeHandlerVersion(); + } + + /** + * Set the typeHandlerVersion property: Specifies the version of the script handler. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the MachineExtensionInner object itself. + */ + public MachineExtensionInner withTypeHandlerVersion(String typeHandlerVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new MachineExtensionProperties(); + } + this.innerProperties().withTypeHandlerVersion(typeHandlerVersion); + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.innerProperties() == null ? null : this.innerProperties().autoUpgradeMinorVersion(); + } + + /** + * Set the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the MachineExtensionInner object itself. + */ + public MachineExtensionInner withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new MachineExtensionProperties(); + } + this.innerProperties().withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } + + /** + * Get the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + public Object settings() { + return this.innerProperties() == null ? null : this.innerProperties().settings(); + } + + /** + * Set the settings property: Json formatted public settings for the extension. + * + * @param settings the settings value to set. + * @return the MachineExtensionInner object itself. + */ + public MachineExtensionInner withSettings(Object settings) { + if (this.innerProperties() == null) { + this.innerProperties = new MachineExtensionProperties(); + } + this.innerProperties().withSettings(settings); + return this; + } + + /** + * Get the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + public Object protectedSettings() { + return this.innerProperties() == null ? null : this.innerProperties().protectedSettings(); + } + + /** + * Set the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @param protectedSettings the protectedSettings value to set. + * @return the MachineExtensionInner object itself. + */ + public MachineExtensionInner withProtectedSettings(Object protectedSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new MachineExtensionProperties(); + } + this.innerProperties().withProtectedSettings(protectedSettings); + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the instanceView property: The machine extension instance view. + * + * @return the instanceView value. + */ + public MachineExtensionPropertiesInstanceView instanceView() { + return this.innerProperties() == null ? null : this.innerProperties().instanceView(); + } + + /** + * Set the instanceView property: The machine extension instance view. + * + * @param instanceView the instanceView value to set. + * @return the MachineExtensionInner object itself. + */ + public MachineExtensionInner withInstanceView(MachineExtensionPropertiesInstanceView instanceView) { + if (this.innerProperties() == null) { + this.innerProperties = new MachineExtensionProperties(); + } + this.innerProperties().withInstanceView(instanceView); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/MachineExtensionProperties.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/MachineExtensionProperties.java new file mode 100644 index 000000000000..3f56b99eb5c8 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/MachineExtensionProperties.java @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.models.MachineExtensionPropertiesInstanceView; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of a Machine Extension. */ +@Fluent +public final class MachineExtensionProperties { + /* + * How the extension handler should be forced to update even if the + * extension configuration has not changed. + */ + @JsonProperty(value = "forceUpdateTag") + private String forceUpdateTag; + + /* + * The name of the extension handler publisher. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /* + * Specifies the type of the extension; an example is + * "CustomScriptExtension". + */ + @JsonProperty(value = "type") + private String type; + + /* + * Specifies the version of the script handler. + */ + @JsonProperty(value = "typeHandlerVersion") + private String typeHandlerVersion; + + /* + * Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension + * will not upgrade minor versions unless redeployed, even with this + * property set to true. + */ + @JsonProperty(value = "autoUpgradeMinorVersion") + private Boolean autoUpgradeMinorVersion; + + /* + * Json formatted public settings for the extension. + */ + @JsonProperty(value = "settings") + private Object settings; + + /* + * The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + */ + @JsonProperty(value = "protectedSettings") + private Object protectedSettings; + + /* + * The provisioning state, which only appears in the response. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The machine extension instance view. + */ + @JsonProperty(value = "instanceView") + private MachineExtensionPropertiesInstanceView instanceView; + + /** + * Get the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.forceUpdateTag; + } + + /** + * Set the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the MachineExtensionProperties object itself. + */ + public MachineExtensionProperties withForceUpdateTag(String forceUpdateTag) { + this.forceUpdateTag = forceUpdateTag; + return this; + } + + /** + * Get the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The name of the extension handler publisher. + * + * @param publisher the publisher value to set. + * @return the MachineExtensionProperties object itself. + */ + public MachineExtensionProperties withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @param type the type value to set. + * @return the MachineExtensionProperties object itself. + */ + public MachineExtensionProperties withType(String type) { + this.type = type; + return this; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.typeHandlerVersion; + } + + /** + * Set the typeHandlerVersion property: Specifies the version of the script handler. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the MachineExtensionProperties object itself. + */ + public MachineExtensionProperties withTypeHandlerVersion(String typeHandlerVersion) { + this.typeHandlerVersion = typeHandlerVersion; + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.autoUpgradeMinorVersion; + } + + /** + * Set the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the MachineExtensionProperties object itself. + */ + public MachineExtensionProperties withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + this.autoUpgradeMinorVersion = autoUpgradeMinorVersion; + return this; + } + + /** + * Get the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + public Object settings() { + return this.settings; + } + + /** + * Set the settings property: Json formatted public settings for the extension. + * + * @param settings the settings value to set. + * @return the MachineExtensionProperties object itself. + */ + public MachineExtensionProperties withSettings(Object settings) { + this.settings = settings; + return this; + } + + /** + * Get the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + public Object protectedSettings() { + return this.protectedSettings; + } + + /** + * Set the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @param protectedSettings the protectedSettings value to set. + * @return the MachineExtensionProperties object itself. + */ + public MachineExtensionProperties withProtectedSettings(Object protectedSettings) { + this.protectedSettings = protectedSettings; + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the instanceView property: The machine extension instance view. + * + * @return the instanceView value. + */ + public MachineExtensionPropertiesInstanceView instanceView() { + return this.instanceView; + } + + /** + * Set the instanceView property: The machine extension instance view. + * + * @param instanceView the instanceView value to set. + * @return the MachineExtensionProperties object itself. + */ + public MachineExtensionProperties withInstanceView(MachineExtensionPropertiesInstanceView instanceView) { + this.instanceView = instanceView; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (instanceView() != null) { + instanceView().validate(); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/MachineExtensionUpdateProperties.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/MachineExtensionUpdateProperties.java new file mode 100644 index 000000000000..9064931616d0 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/MachineExtensionUpdateProperties.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of a Machine Extension. */ +@Fluent +public final class MachineExtensionUpdateProperties { + /* + * How the extension handler should be forced to update even if the + * extension configuration has not changed. + */ + @JsonProperty(value = "forceUpdateTag") + private String forceUpdateTag; + + /* + * The name of the extension handler publisher. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /* + * Specifies the type of the extension; an example is + * "CustomScriptExtension". + */ + @JsonProperty(value = "type") + private String type; + + /* + * Specifies the version of the script handler. + */ + @JsonProperty(value = "typeHandlerVersion") + private String typeHandlerVersion; + + /* + * Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension + * will not upgrade minor versions unless redeployed, even with this + * property set to true. + */ + @JsonProperty(value = "autoUpgradeMinorVersion") + private Boolean autoUpgradeMinorVersion; + + /* + * Json formatted public settings for the extension. + */ + @JsonProperty(value = "settings") + private Object settings; + + /* + * The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + */ + @JsonProperty(value = "protectedSettings") + private Object protectedSettings; + + /** + * Get the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.forceUpdateTag; + } + + /** + * Set the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the MachineExtensionUpdateProperties object itself. + */ + public MachineExtensionUpdateProperties withForceUpdateTag(String forceUpdateTag) { + this.forceUpdateTag = forceUpdateTag; + return this; + } + + /** + * Get the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The name of the extension handler publisher. + * + * @param publisher the publisher value to set. + * @return the MachineExtensionUpdateProperties object itself. + */ + public MachineExtensionUpdateProperties withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @param type the type value to set. + * @return the MachineExtensionUpdateProperties object itself. + */ + public MachineExtensionUpdateProperties withType(String type) { + this.type = type; + return this; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.typeHandlerVersion; + } + + /** + * Set the typeHandlerVersion property: Specifies the version of the script handler. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the MachineExtensionUpdateProperties object itself. + */ + public MachineExtensionUpdateProperties withTypeHandlerVersion(String typeHandlerVersion) { + this.typeHandlerVersion = typeHandlerVersion; + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.autoUpgradeMinorVersion; + } + + /** + * Set the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the MachineExtensionUpdateProperties object itself. + */ + public MachineExtensionUpdateProperties withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + this.autoUpgradeMinorVersion = autoUpgradeMinorVersion; + return this; + } + + /** + * Get the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + public Object settings() { + return this.settings; + } + + /** + * Set the settings property: Json formatted public settings for the extension. + * + * @param settings the settings value to set. + * @return the MachineExtensionUpdateProperties object itself. + */ + public MachineExtensionUpdateProperties withSettings(Object settings) { + this.settings = settings; + return this; + } + + /** + * Get the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + public Object protectedSettings() { + return this.protectedSettings; + } + + /** + * Set the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @param protectedSettings the protectedSettings value to set. + * @return the MachineExtensionUpdateProperties object itself. + */ + public MachineExtensionUpdateProperties withProtectedSettings(Object protectedSettings) { + this.protectedSettings = protectedSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/OperationInner.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/OperationInner.java new file mode 100644 index 000000000000..ee3f0e2122d2 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/OperationInner.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.connectedvmware.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Operation provided by provider. */ +@Fluent +public final class OperationInner { + /* + * Name of the operation + */ + @JsonProperty(value = "name") + private String name; + + /* + * Indicates whether the operation is data action or not. + */ + @JsonProperty(value = "isDataAction") + private Boolean isDataAction; + + /* + * Properties of the operation + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get the name property: Name of the operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the operation. + * + * @param name the name value to set. + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the isDataAction property: Indicates whether the operation is data action or not. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Set the isDataAction property: Indicates whether the operation is data action or not. + * + * @param isDataAction the isDataAction value to set. + * @return the OperationInner object itself. + */ + public OperationInner withIsDataAction(Boolean isDataAction) { + this.isDataAction = isDataAction; + return this; + } + + /** + * Get the display property: Properties of the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Properties of the operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay 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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/ResourcePoolInner.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/ResourcePoolInner.java new file mode 100644 index 000000000000..51ed1ffeba27 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/ResourcePoolInner.java @@ -0,0 +1,317 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.models.ExtendedLocation; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Define the resourcePool. */ +@Fluent +public final class ResourcePoolInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties", required = true) + private ResourcePoolProperties innerProperties = new ResourcePoolProperties(); + + /* + * Gets or sets the extended location. + */ + @JsonProperty(value = "extendedLocation") + private ExtendedLocation extendedLocation; + + /* + * 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 ResourcePoolProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the extendedLocation property: Gets or sets the extended location. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: Gets or sets the extended location. + * + * @param extendedLocation the extendedLocation value to set. + * @return the ResourcePoolInner object itself. + */ + public ResourcePoolInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** + * 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 ResourcePoolInner object itself. + */ + public ResourcePoolInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourcePoolInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourcePoolInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + public String uuid() { + return this.innerProperties() == null ? null : this.innerProperties().uuid(); + } + + /** + * Get the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this resource pool resides. + * + * @return the vCenterId value. + */ + public String vCenterId() { + return this.innerProperties() == null ? null : this.innerProperties().vCenterId(); + } + + /** + * Set the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this resource pool resides. + * + * @param vCenterId the vCenterId value to set. + * @return the ResourcePoolInner object itself. + */ + public ResourcePoolInner withVCenterId(String vCenterId) { + if (this.innerProperties() == null) { + this.innerProperties = new ResourcePoolProperties(); + } + this.innerProperties().withVCenterId(vCenterId); + return this; + } + + /** + * Get the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the resource pool. + * + * @return the moRefId value. + */ + public String moRefId() { + return this.innerProperties() == null ? null : this.innerProperties().moRefId(); + } + + /** + * Set the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the resource pool. + * + * @param moRefId the moRefId value to set. + * @return the ResourcePoolInner object itself. + */ + public ResourcePoolInner withMoRefId(String moRefId) { + if (this.innerProperties() == null) { + this.innerProperties = new ResourcePoolProperties(); + } + this.innerProperties().withMoRefId(moRefId); + return this; + } + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the resource pool. + * + * @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 pool. + * + * @param inventoryItemId the inventoryItemId value to set. + * @return the ResourcePoolInner object itself. + */ + public ResourcePoolInner withInventoryItemId(String inventoryItemId) { + if (this.innerProperties() == null) { + this.innerProperties = new ResourcePoolProperties(); + } + this.innerProperties().withInventoryItemId(inventoryItemId); + return this; + } + + /** + * Get the moName property: Gets or sets the vCenter Managed Object name for the resource pool. + * + * @return the moName value. + */ + public String moName() { + return this.innerProperties() == null ? null : this.innerProperties().moName(); + } + + /** + * Get the cpuSharesLevel property: Gets or sets CPUSharesLevel which specifies the CPU allocation level for this + * pool. This property is used in relative allocation between resource consumers. + * + * @return the cpuSharesLevel value. + */ + public String cpuSharesLevel() { + return this.innerProperties() == null ? null : this.innerProperties().cpuSharesLevel(); + } + + /** + * Get the cpuReservationMHz property: Gets or sets CPUReservationMHz which specifies the CPU size in MHz that is + * guaranteed to be available. + * + * @return the cpuReservationMHz value. + */ + public Long cpuReservationMHz() { + return this.innerProperties() == null ? null : this.innerProperties().cpuReservationMHz(); + } + + /** + * Get the cpuLimitMHz property: Gets or sets CPULimitMHz which specifies a CPU usage limit in MHz. Utilization will + * not exceed this limit even if there are available resources. + * + * @return the cpuLimitMHz value. + */ + public Long cpuLimitMHz() { + return this.innerProperties() == null ? null : this.innerProperties().cpuLimitMHz(); + } + + /** + * Get the memSharesLevel property: Gets or sets CPUSharesLevel which specifies the memory allocation level for this + * pool. This property is used in relative allocation between resource consumers. + * + * @return the memSharesLevel value. + */ + public String memSharesLevel() { + return this.innerProperties() == null ? null : this.innerProperties().memSharesLevel(); + } + + /** + * Get the memReservationMB property: Gets or sets MemReservationMB which specifies the guaranteed available memory + * in megabytes. + * + * @return the memReservationMB value. + */ + public Long memReservationMB() { + return this.innerProperties() == null ? null : this.innerProperties().memReservationMB(); + } + + /** + * Get the memLimitMB property: Gets or sets MemLimitMB specifies a memory usage limit in megabytes. Utilization + * will not exceed the specified limit even if there are available resources. + * + * @return the memLimitMB value. + */ + public Long memLimitMB() { + return this.innerProperties() == null ? null : this.innerProperties().memLimitMB(); + } + + /** + * Get the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + public String customResourceName() { + return this.innerProperties() == null ? null : this.innerProperties().customResourceName(); + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.innerProperties() == null ? null : this.innerProperties().statuses(); + } + + /** + * 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 ResourcePoolInner")); + } else { + innerProperties().validate(); + } + if (extendedLocation() != null) { + extendedLocation().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ResourcePoolInner.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/ResourcePoolProperties.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/ResourcePoolProperties.java new file mode 100644 index 000000000000..368c0013951e --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/ResourcePoolProperties.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.connectedvmware.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Defines the resource properties. */ +@Fluent +public final class ResourcePoolProperties { + /* + * Gets or sets a unique identifier for this resource. + */ + @JsonProperty(value = "uuid", access = JsonProperty.Access.WRITE_ONLY) + private String uuid; + + /* + * Gets or sets the ARM Id of the vCenter resource in which this resource + * pool resides. + */ + @JsonProperty(value = "vCenterId") + private String vCenterId; + + /* + * Gets or sets the vCenter MoRef (Managed Object Reference) ID for the + * resource pool. + */ + @JsonProperty(value = "moRefId") + private String moRefId; + + /* + * Gets or sets the inventory Item ID for the resource pool. + */ + @JsonProperty(value = "inventoryItemId") + private String inventoryItemId; + + /* + * Gets or sets the vCenter Managed Object name for the resource pool. + */ + @JsonProperty(value = "moName", access = JsonProperty.Access.WRITE_ONLY) + private String moName; + + /* + * Gets or sets CPUSharesLevel which specifies the CPU allocation level for + * this pool. + * This property is used in relative allocation between resource consumers. + */ + @JsonProperty(value = "cpuSharesLevel", access = JsonProperty.Access.WRITE_ONLY) + private String cpuSharesLevel; + + /* + * Gets or sets CPUReservationMHz which specifies the CPU size in MHz that + * is guaranteed + * to be available. + */ + @JsonProperty(value = "cpuReservationMHz", access = JsonProperty.Access.WRITE_ONLY) + private Long cpuReservationMHz; + + /* + * Gets or sets CPULimitMHz which specifies a CPU usage limit in MHz. + * Utilization will not exceed this limit even if there are available + * resources. + */ + @JsonProperty(value = "cpuLimitMHz", access = JsonProperty.Access.WRITE_ONLY) + private Long cpuLimitMHz; + + /* + * Gets or sets CPUSharesLevel which specifies the memory allocation level + * for this pool. + * This property is used in relative allocation between resource consumers. + */ + @JsonProperty(value = "memSharesLevel", access = JsonProperty.Access.WRITE_ONLY) + private String memSharesLevel; + + /* + * Gets or sets MemReservationMB which specifies the guaranteed available + * memory in + * megabytes. + */ + @JsonProperty(value = "memReservationMB", access = JsonProperty.Access.WRITE_ONLY) + private Long memReservationMB; + + /* + * Gets or sets MemLimitMB specifies a memory usage limit in megabytes. + * Utilization will not exceed the specified limit even if there are + * available resources. + */ + @JsonProperty(value = "memLimitMB", access = JsonProperty.Access.WRITE_ONLY) + private Long memLimitMB; + + /* + * Gets the name of the corresponding resource in Kubernetes. + */ + @JsonProperty(value = "customResourceName", access = JsonProperty.Access.WRITE_ONLY) + private String customResourceName; + + /* + * The resource status information. + */ + @JsonProperty(value = "statuses", access = JsonProperty.Access.WRITE_ONLY) + private List statuses; + + /* + * Gets or sets the provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + public String uuid() { + return this.uuid; + } + + /** + * Get the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this resource pool resides. + * + * @return the vCenterId value. + */ + public String vCenterId() { + return this.vCenterId; + } + + /** + * Set the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this resource pool resides. + * + * @param vCenterId the vCenterId value to set. + * @return the ResourcePoolProperties object itself. + */ + public ResourcePoolProperties withVCenterId(String vCenterId) { + this.vCenterId = vCenterId; + return this; + } + + /** + * Get the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the resource pool. + * + * @return the moRefId value. + */ + public String moRefId() { + return this.moRefId; + } + + /** + * Set the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the resource pool. + * + * @param moRefId the moRefId value to set. + * @return the ResourcePoolProperties object itself. + */ + public ResourcePoolProperties withMoRefId(String moRefId) { + this.moRefId = moRefId; + return this; + } + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the resource pool. + * + * @return the inventoryItemId value. + */ + public String inventoryItemId() { + return this.inventoryItemId; + } + + /** + * Set the inventoryItemId property: Gets or sets the inventory Item ID for the resource pool. + * + * @param inventoryItemId the inventoryItemId value to set. + * @return the ResourcePoolProperties object itself. + */ + public ResourcePoolProperties withInventoryItemId(String inventoryItemId) { + this.inventoryItemId = inventoryItemId; + return this; + } + + /** + * Get the moName property: Gets or sets the vCenter Managed Object name for the resource pool. + * + * @return the moName value. + */ + public String moName() { + return this.moName; + } + + /** + * Get the cpuSharesLevel property: Gets or sets CPUSharesLevel which specifies the CPU allocation level for this + * pool. This property is used in relative allocation between resource consumers. + * + * @return the cpuSharesLevel value. + */ + public String cpuSharesLevel() { + return this.cpuSharesLevel; + } + + /** + * Get the cpuReservationMHz property: Gets or sets CPUReservationMHz which specifies the CPU size in MHz that is + * guaranteed to be available. + * + * @return the cpuReservationMHz value. + */ + public Long cpuReservationMHz() { + return this.cpuReservationMHz; + } + + /** + * Get the cpuLimitMHz property: Gets or sets CPULimitMHz which specifies a CPU usage limit in MHz. Utilization will + * not exceed this limit even if there are available resources. + * + * @return the cpuLimitMHz value. + */ + public Long cpuLimitMHz() { + return this.cpuLimitMHz; + } + + /** + * Get the memSharesLevel property: Gets or sets CPUSharesLevel which specifies the memory allocation level for this + * pool. This property is used in relative allocation between resource consumers. + * + * @return the memSharesLevel value. + */ + public String memSharesLevel() { + return this.memSharesLevel; + } + + /** + * Get the memReservationMB property: Gets or sets MemReservationMB which specifies the guaranteed available memory + * in megabytes. + * + * @return the memReservationMB value. + */ + public Long memReservationMB() { + return this.memReservationMB; + } + + /** + * Get the memLimitMB property: Gets or sets MemLimitMB specifies a memory usage limit in megabytes. Utilization + * will not exceed the specified limit even if there are available resources. + * + * @return the memLimitMB value. + */ + public Long memLimitMB() { + return this.memLimitMB; + } + + /** + * Get the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + public String customResourceName() { + return this.customResourceName; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * 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 (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VCenterInner.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VCenterInner.java new file mode 100644 index 000000000000..e519b94fcc45 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VCenterInner.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.models.ExtendedLocation; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.azure.resourcemanager.connectedvmware.models.VICredential; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Defines the vCenter. */ +@Fluent +public final class VCenterInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties", required = true) + private VCenterProperties innerProperties = new VCenterProperties(); + + /* + * Gets or sets the extended location. + */ + @JsonProperty(value = "extendedLocation") + private ExtendedLocation extendedLocation; + + /* + * 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 VCenterProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the extendedLocation property: Gets or sets the extended location. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: Gets or sets the extended location. + * + * @param extendedLocation the extendedLocation value to set. + * @return the VCenterInner object itself. + */ + public VCenterInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** + * 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 VCenterInner object itself. + */ + public VCenterInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** {@inheritDoc} */ + @Override + public VCenterInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public VCenterInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + public String uuid() { + return this.innerProperties() == null ? null : this.innerProperties().uuid(); + } + + /** + * Get the fqdn property: Gets or sets the FQDN/IPAddress of the vCenter. + * + * @return the fqdn value. + */ + public String fqdn() { + return this.innerProperties() == null ? null : this.innerProperties().fqdn(); + } + + /** + * Set the fqdn property: Gets or sets the FQDN/IPAddress of the vCenter. + * + * @param fqdn the fqdn value to set. + * @return the VCenterInner object itself. + */ + public VCenterInner withFqdn(String fqdn) { + if (this.innerProperties() == null) { + this.innerProperties = new VCenterProperties(); + } + this.innerProperties().withFqdn(fqdn); + return this; + } + + /** + * Get the port property: Gets or sets the port of the vCenter. + * + * @return the port value. + */ + public Integer port() { + return this.innerProperties() == null ? null : this.innerProperties().port(); + } + + /** + * Set the port property: Gets or sets the port of the vCenter. + * + * @param port the port value to set. + * @return the VCenterInner object itself. + */ + public VCenterInner withPort(Integer port) { + if (this.innerProperties() == null) { + this.innerProperties = new VCenterProperties(); + } + this.innerProperties().withPort(port); + return this; + } + + /** + * Get the version property: Gets or sets the version of the vCenter. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Get the instanceUuid property: Gets or sets the instance UUID of the vCenter. + * + * @return the instanceUuid value. + */ + public String instanceUuid() { + return this.innerProperties() == null ? null : this.innerProperties().instanceUuid(); + } + + /** + * Get the connectionStatus property: Gets or sets the connection status to the vCenter. + * + * @return the connectionStatus value. + */ + public String connectionStatus() { + return this.innerProperties() == null ? null : this.innerProperties().connectionStatus(); + } + + /** + * Get the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + public String customResourceName() { + return this.innerProperties() == null ? null : this.innerProperties().customResourceName(); + } + + /** + * Get the credentials property: Username / Password Credentials to connect to vcenter. + * + * @return the credentials value. + */ + public VICredential credentials() { + return this.innerProperties() == null ? null : this.innerProperties().credentials(); + } + + /** + * Set the credentials property: Username / Password Credentials to connect to vcenter. + * + * @param credentials the credentials value to set. + * @return the VCenterInner object itself. + */ + public VCenterInner withCredentials(VICredential credentials) { + if (this.innerProperties() == null) { + this.innerProperties = new VCenterProperties(); + } + this.innerProperties().withCredentials(credentials); + return this; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.innerProperties() == null ? null : this.innerProperties().statuses(); + } + + /** + * 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 VCenterInner")); + } else { + innerProperties().validate(); + } + if (extendedLocation() != null) { + extendedLocation().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VCenterInner.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VCenterProperties.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VCenterProperties.java new file mode 100644 index 000000000000..0415fd32a32e --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VCenterProperties.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.azure.resourcemanager.connectedvmware.models.VICredential; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Defines the resource properties. */ +@Fluent +public final class VCenterProperties { + /* + * Gets or sets a unique identifier for this resource. + */ + @JsonProperty(value = "uuid", access = JsonProperty.Access.WRITE_ONLY) + private String uuid; + + /* + * Gets or sets the FQDN/IPAddress of the vCenter. + */ + @JsonProperty(value = "fqdn", required = true) + private String fqdn; + + /* + * Gets or sets the port of the vCenter. + */ + @JsonProperty(value = "port") + private Integer port; + + /* + * Gets or sets the version of the vCenter. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /* + * Gets or sets the instance UUID of the vCenter. + */ + @JsonProperty(value = "instanceUuid", access = JsonProperty.Access.WRITE_ONLY) + private String instanceUuid; + + /* + * Gets or sets the connection status to the vCenter. + */ + @JsonProperty(value = "connectionStatus", access = JsonProperty.Access.WRITE_ONLY) + private String connectionStatus; + + /* + * Gets the name of the corresponding resource in Kubernetes. + */ + @JsonProperty(value = "customResourceName", access = JsonProperty.Access.WRITE_ONLY) + private String customResourceName; + + /* + * Username / Password Credentials to connect to vcenter. + */ + @JsonProperty(value = "credentials") + private VICredential credentials; + + /* + * The resource status information. + */ + @JsonProperty(value = "statuses", access = JsonProperty.Access.WRITE_ONLY) + private List statuses; + + /* + * Gets or sets the provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + public String uuid() { + return this.uuid; + } + + /** + * Get the fqdn property: Gets or sets the FQDN/IPAddress of the vCenter. + * + * @return the fqdn value. + */ + public String fqdn() { + return this.fqdn; + } + + /** + * Set the fqdn property: Gets or sets the FQDN/IPAddress of the vCenter. + * + * @param fqdn the fqdn value to set. + * @return the VCenterProperties object itself. + */ + public VCenterProperties withFqdn(String fqdn) { + this.fqdn = fqdn; + return this; + } + + /** + * Get the port property: Gets or sets the port of the vCenter. + * + * @return the port value. + */ + public Integer port() { + return this.port; + } + + /** + * Set the port property: Gets or sets the port of the vCenter. + * + * @param port the port value to set. + * @return the VCenterProperties object itself. + */ + public VCenterProperties withPort(Integer port) { + this.port = port; + return this; + } + + /** + * Get the version property: Gets or sets the version of the vCenter. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Get the instanceUuid property: Gets or sets the instance UUID of the vCenter. + * + * @return the instanceUuid value. + */ + public String instanceUuid() { + return this.instanceUuid; + } + + /** + * Get the connectionStatus property: Gets or sets the connection status to the vCenter. + * + * @return the connectionStatus value. + */ + public String connectionStatus() { + return this.connectionStatus; + } + + /** + * Get the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + public String customResourceName() { + return this.customResourceName; + } + + /** + * Get the credentials property: Username / Password Credentials to connect to vcenter. + * + * @return the credentials value. + */ + public VICredential credentials() { + return this.credentials; + } + + /** + * Set the credentials property: Username / Password Credentials to connect to vcenter. + * + * @param credentials the credentials value to set. + * @return the VCenterProperties object itself. + */ + public VCenterProperties withCredentials(VICredential credentials) { + this.credentials = credentials; + return this; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * 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 (fqdn() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property fqdn in model VCenterProperties")); + } + if (credentials() != null) { + credentials().validate(); + } + if (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VCenterProperties.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VirtualMachineInner.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VirtualMachineInner.java new file mode 100644 index 000000000000..5a7ec67f70f5 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VirtualMachineInner.java @@ -0,0 +1,562 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.models.ExtendedLocation; +import com.azure.resourcemanager.connectedvmware.models.FirmwareType; +import com.azure.resourcemanager.connectedvmware.models.GuestAgentProfile; +import com.azure.resourcemanager.connectedvmware.models.HardwareProfile; +import com.azure.resourcemanager.connectedvmware.models.Identity; +import com.azure.resourcemanager.connectedvmware.models.NetworkProfile; +import com.azure.resourcemanager.connectedvmware.models.OsProfile; +import com.azure.resourcemanager.connectedvmware.models.PlacementProfile; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.azure.resourcemanager.connectedvmware.models.StorageProfile; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Define the virtualMachine. */ +@Fluent +public final class VirtualMachineInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties", required = true) + private VirtualMachineProperties innerProperties = new VirtualMachineProperties(); + + /* + * Gets or sets the extended location. + */ + @JsonProperty(value = "extendedLocation") + private ExtendedLocation extendedLocation; + + /* + * 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; + + /* + * The identity of the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private VirtualMachineProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the extendedLocation property: Gets or sets the extended location. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: Gets or sets 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; + } + + /** + * 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 VirtualMachineInner object itself. + */ + public VirtualMachineInner withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get the identity property: The identity of the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the resource. + * + * @param identity the identity value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withIdentity(Identity identity) { + this.identity = identity; + 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 resourcePoolId property: Gets or sets the ARM Id of the resourcePool resource on which this virtual + * machine will deploy. + * + * @return the resourcePoolId value. + */ + public String resourcePoolId() { + return this.innerProperties() == null ? null : this.innerProperties().resourcePoolId(); + } + + /** + * Set the resourcePoolId property: Gets or sets the ARM Id of the resourcePool resource on which this virtual + * machine will deploy. + * + * @param resourcePoolId the resourcePoolId value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withResourcePoolId(String resourcePoolId) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineProperties(); + } + this.innerProperties().withResourcePoolId(resourcePoolId); + return this; + } + + /** + * Get the templateId property: Gets or sets the ARM Id of the template resource to deploy the virtual machine. + * + * @return the templateId value. + */ + public String templateId() { + return this.innerProperties() == null ? null : this.innerProperties().templateId(); + } + + /** + * Set the templateId property: Gets or sets the ARM Id of the template resource to deploy the virtual machine. + * + * @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 vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this resource pool resides. + * + * @return the vCenterId value. + */ + public String vCenterId() { + return this.innerProperties() == null ? null : this.innerProperties().vCenterId(); + } + + /** + * Set the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this resource pool resides. + * + * @param vCenterId the vCenterId value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withVCenterId(String vCenterId) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineProperties(); + } + this.innerProperties().withVCenterId(vCenterId); + return this; + } + + /** + * Get the placementProfile property: Placement properties. + * + * @return the placementProfile value. + */ + public PlacementProfile placementProfile() { + return this.innerProperties() == null ? null : this.innerProperties().placementProfile(); + } + + /** + * Set the placementProfile property: Placement properties. + * + * @param placementProfile the placementProfile value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withPlacementProfile(PlacementProfile placementProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineProperties(); + } + this.innerProperties().withPlacementProfile(placementProfile); + 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 guestAgentProfile property: Guest agent status properties. + * + * @return the guestAgentProfile value. + */ + public GuestAgentProfile guestAgentProfile() { + return this.innerProperties() == null ? null : this.innerProperties().guestAgentProfile(); + } + + /** + * Set the guestAgentProfile property: Guest agent status properties. + * + * @param guestAgentProfile the guestAgentProfile value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withGuestAgentProfile(GuestAgentProfile guestAgentProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineProperties(); + } + this.innerProperties().withGuestAgentProfile(guestAgentProfile); + return this; + } + + /** + * Get the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual machine. + * + * @return the moRefId value. + */ + public String moRefId() { + return this.innerProperties() == null ? null : this.innerProperties().moRefId(); + } + + /** + * Set the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual machine. + * + * @param moRefId the moRefId value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withMoRefId(String moRefId) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineProperties(); + } + this.innerProperties().withMoRefId(moRefId); + return this; + } + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the virtual machine. + * + * @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 virtual machine. + * + * @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 moName property: Gets or sets the vCenter Managed Object name for the virtual machine. + * + * @return the moName value. + */ + public String moName() { + return this.innerProperties() == null ? null : this.innerProperties().moName(); + } + + /** + * Get the folderPath property: Gets or sets the folder path of the vm. + * + * @return the folderPath value. + */ + public String folderPath() { + return this.innerProperties() == null ? null : this.innerProperties().folderPath(); + } + + /** + * Get the instanceUuid property: Gets or sets the instance uuid of the vm. + * + * @return the instanceUuid value. + */ + public String instanceUuid() { + return this.innerProperties() == null ? null : this.innerProperties().instanceUuid(); + } + + /** + * Get the smbiosUuid property: Gets or sets the SMBIOS UUID of the vm. + * + * @return the smbiosUuid value. + */ + public String smbiosUuid() { + return this.innerProperties() == null ? null : this.innerProperties().smbiosUuid(); + } + + /** + * Set the smbiosUuid property: Gets or sets the SMBIOS UUID of the vm. + * + * @param smbiosUuid the smbiosUuid value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withSmbiosUuid(String smbiosUuid) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineProperties(); + } + this.innerProperties().withSmbiosUuid(smbiosUuid); + return this; + } + + /** + * Get the firmwareType property: Firmware type. + * + * @return the firmwareType value. + */ + public FirmwareType firmwareType() { + return this.innerProperties() == null ? null : this.innerProperties().firmwareType(); + } + + /** + * Set the firmwareType property: Firmware type. + * + * @param firmwareType the firmwareType value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withFirmwareType(FirmwareType firmwareType) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineProperties(); + } + this.innerProperties().withFirmwareType(firmwareType); + 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 customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + public String customResourceName() { + return this.innerProperties() == null ? null : this.innerProperties().customResourceName(); + } + + /** + * Get the uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + public String uuid() { + return this.innerProperties() == null ? null : this.innerProperties().uuid(); + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.innerProperties() == null ? null : this.innerProperties().statuses(); + } + + /** + * 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(); + } + + /** + * Get the vmId property: Gets or sets a unique identifier for the vm resource. + * + * @return the vmId value. + */ + public String vmId() { + return this.innerProperties() == null ? null : this.innerProperties().vmId(); + } + + /** + * 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) { + extendedLocation().validate(); + } + if (identity() != null) { + identity().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualMachineInner.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VirtualMachineProperties.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VirtualMachineProperties.java new file mode 100644 index 000000000000..8d254fe8b019 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VirtualMachineProperties.java @@ -0,0 +1,530 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.models.FirmwareType; +import com.azure.resourcemanager.connectedvmware.models.GuestAgentProfile; +import com.azure.resourcemanager.connectedvmware.models.HardwareProfile; +import com.azure.resourcemanager.connectedvmware.models.NetworkProfile; +import com.azure.resourcemanager.connectedvmware.models.OsProfile; +import com.azure.resourcemanager.connectedvmware.models.PlacementProfile; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.azure.resourcemanager.connectedvmware.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 ARM Id of the resourcePool resource on which this + * virtual machine will + * deploy. + */ + @JsonProperty(value = "resourcePoolId") + private String resourcePoolId; + + /* + * Gets or sets the ARM Id of the template resource to deploy the virtual + * machine. + */ + @JsonProperty(value = "templateId") + private String templateId; + + /* + * Gets or sets the ARM Id of the vCenter resource in which this resource + * pool resides. + */ + @JsonProperty(value = "vCenterId") + private String vCenterId; + + /* + * Placement properties. + */ + @JsonProperty(value = "placementProfile") + private PlacementProfile placementProfile; + + /* + * 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; + + /* + * Guest agent status properties. + */ + @JsonProperty(value = "guestAgentProfile") + private GuestAgentProfile guestAgentProfile; + + /* + * Gets or sets the vCenter MoRef (Managed Object Reference) ID for the + * virtual machine. + */ + @JsonProperty(value = "moRefId") + private String moRefId; + + /* + * Gets or sets the inventory Item ID for the virtual machine. + */ + @JsonProperty(value = "inventoryItemId") + private String inventoryItemId; + + /* + * Gets or sets the vCenter Managed Object name for the virtual machine. + */ + @JsonProperty(value = "moName", access = JsonProperty.Access.WRITE_ONLY) + private String moName; + + /* + * Gets or sets the folder path of the vm. + */ + @JsonProperty(value = "folderPath", access = JsonProperty.Access.WRITE_ONLY) + private String folderPath; + + /* + * Gets or sets the instance uuid of the vm. + */ + @JsonProperty(value = "instanceUuid", access = JsonProperty.Access.WRITE_ONLY) + private String instanceUuid; + + /* + * Gets or sets the SMBIOS UUID of the vm. + */ + @JsonProperty(value = "smbiosUuid") + private String smbiosUuid; + + /* + * Firmware type + */ + @JsonProperty(value = "firmwareType") + private FirmwareType firmwareType; + + /* + * Gets the power state of the virtual machine. + */ + @JsonProperty(value = "powerState", access = JsonProperty.Access.WRITE_ONLY) + private String powerState; + + /* + * Gets the name of the corresponding resource in Kubernetes. + */ + @JsonProperty(value = "customResourceName", access = JsonProperty.Access.WRITE_ONLY) + private String customResourceName; + + /* + * Gets or sets a unique identifier for this resource. + */ + @JsonProperty(value = "uuid", access = JsonProperty.Access.WRITE_ONLY) + private String uuid; + + /* + * The resource status information. + */ + @JsonProperty(value = "statuses", access = JsonProperty.Access.WRITE_ONLY) + private List statuses; + + /* + * Gets or sets the provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * Gets or sets a unique identifier for the vm resource. + */ + @JsonProperty(value = "vmId", access = JsonProperty.Access.WRITE_ONLY) + private String vmId; + + /** + * Get the resourcePoolId property: Gets or sets the ARM Id of the resourcePool resource on which this virtual + * machine will deploy. + * + * @return the resourcePoolId value. + */ + public String resourcePoolId() { + return this.resourcePoolId; + } + + /** + * Set the resourcePoolId property: Gets or sets the ARM Id of the resourcePool resource on which this virtual + * machine will deploy. + * + * @param resourcePoolId the resourcePoolId value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withResourcePoolId(String resourcePoolId) { + this.resourcePoolId = resourcePoolId; + return this; + } + + /** + * Get the templateId property: Gets or sets the ARM Id of the template resource to deploy the virtual machine. + * + * @return the templateId value. + */ + public String templateId() { + return this.templateId; + } + + /** + * Set the templateId property: Gets or sets the ARM Id of the template resource to deploy the virtual machine. + * + * @param templateId the templateId value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + + /** + * Get the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this resource pool resides. + * + * @return the vCenterId value. + */ + public String vCenterId() { + return this.vCenterId; + } + + /** + * Set the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this resource pool resides. + * + * @param vCenterId the vCenterId value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withVCenterId(String vCenterId) { + this.vCenterId = vCenterId; + return this; + } + + /** + * Get the placementProfile property: Placement properties. + * + * @return the placementProfile value. + */ + public PlacementProfile placementProfile() { + return this.placementProfile; + } + + /** + * Set the placementProfile property: Placement properties. + * + * @param placementProfile the placementProfile value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withPlacementProfile(PlacementProfile placementProfile) { + this.placementProfile = placementProfile; + 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 guestAgentProfile property: Guest agent status properties. + * + * @return the guestAgentProfile value. + */ + public GuestAgentProfile guestAgentProfile() { + return this.guestAgentProfile; + } + + /** + * Set the guestAgentProfile property: Guest agent status properties. + * + * @param guestAgentProfile the guestAgentProfile value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withGuestAgentProfile(GuestAgentProfile guestAgentProfile) { + this.guestAgentProfile = guestAgentProfile; + return this; + } + + /** + * Get the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual machine. + * + * @return the moRefId value. + */ + public String moRefId() { + return this.moRefId; + } + + /** + * Set the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual machine. + * + * @param moRefId the moRefId value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withMoRefId(String moRefId) { + this.moRefId = moRefId; + return this; + } + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the virtual machine. + * + * @return the inventoryItemId value. + */ + public String inventoryItemId() { + return this.inventoryItemId; + } + + /** + * Set the inventoryItemId property: Gets or sets the inventory Item ID for the virtual machine. + * + * @param inventoryItemId the inventoryItemId value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withInventoryItemId(String inventoryItemId) { + this.inventoryItemId = inventoryItemId; + return this; + } + + /** + * Get the moName property: Gets or sets the vCenter Managed Object name for the virtual machine. + * + * @return the moName value. + */ + public String moName() { + return this.moName; + } + + /** + * Get the folderPath property: Gets or sets the folder path of the vm. + * + * @return the folderPath value. + */ + public String folderPath() { + return this.folderPath; + } + + /** + * Get the instanceUuid property: Gets or sets the instance uuid of the vm. + * + * @return the instanceUuid value. + */ + public String instanceUuid() { + return this.instanceUuid; + } + + /** + * Get the smbiosUuid property: Gets or sets the SMBIOS UUID of the vm. + * + * @return the smbiosUuid value. + */ + public String smbiosUuid() { + return this.smbiosUuid; + } + + /** + * Set the smbiosUuid property: Gets or sets the SMBIOS UUID of the vm. + * + * @param smbiosUuid the smbiosUuid value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withSmbiosUuid(String smbiosUuid) { + this.smbiosUuid = smbiosUuid; + return this; + } + + /** + * Get the firmwareType property: Firmware type. + * + * @return the firmwareType value. + */ + public FirmwareType firmwareType() { + return this.firmwareType; + } + + /** + * Set the firmwareType property: Firmware type. + * + * @param firmwareType the firmwareType value to set. + * @return the VirtualMachineProperties object itself. + */ + public VirtualMachineProperties withFirmwareType(FirmwareType firmwareType) { + this.firmwareType = firmwareType; + 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 customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + public String customResourceName() { + return this.customResourceName; + } + + /** + * Get the uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + public String uuid() { + return this.uuid; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * Get the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the vmId property: Gets or sets a unique identifier for the vm resource. + * + * @return the vmId value. + */ + public String vmId() { + return this.vmId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (placementProfile() != null) { + placementProfile().validate(); + } + if (osProfile() != null) { + osProfile().validate(); + } + if (hardwareProfile() != null) { + hardwareProfile().validate(); + } + if (networkProfile() != null) { + networkProfile().validate(); + } + if (storageProfile() != null) { + storageProfile().validate(); + } + if (guestAgentProfile() != null) { + guestAgentProfile().validate(); + } + if (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VirtualMachineTemplateInner.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VirtualMachineTemplateInner.java new file mode 100644 index 000000000000..f334d04387f9 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VirtualMachineTemplateInner.java @@ -0,0 +1,364 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.models.ExtendedLocation; +import com.azure.resourcemanager.connectedvmware.models.FirmwareType; +import com.azure.resourcemanager.connectedvmware.models.NetworkInterface; +import com.azure.resourcemanager.connectedvmware.models.OsType; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.azure.resourcemanager.connectedvmware.models.VirtualDisk; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Define the virtualMachineTemplate. */ +@Fluent +public final class VirtualMachineTemplateInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties", required = true) + private VirtualMachineTemplateProperties innerProperties = new VirtualMachineTemplateProperties(); + + /* + * Gets or sets the extended location. + */ + @JsonProperty(value = "extendedLocation") + private ExtendedLocation extendedLocation; + + /* + * 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 VirtualMachineTemplateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the extendedLocation property: Gets or sets the extended location. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: Gets or sets 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; + } + + /** + * 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 VirtualMachineTemplateInner object itself. + */ + public VirtualMachineTemplateInner withKind(String kind) { + this.kind = kind; + 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 uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + public String uuid() { + return this.innerProperties() == null ? null : this.innerProperties().uuid(); + } + + /** + * Get the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this template resides. + * + * @return the vCenterId value. + */ + public String vCenterId() { + return this.innerProperties() == null ? null : this.innerProperties().vCenterId(); + } + + /** + * Set the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this template resides. + * + * @param vCenterId the vCenterId value to set. + * @return the VirtualMachineTemplateInner object itself. + */ + public VirtualMachineTemplateInner withVCenterId(String vCenterId) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineTemplateProperties(); + } + this.innerProperties().withVCenterId(vCenterId); + return this; + } + + /** + * Get the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual machine + * template. + * + * @return the moRefId value. + */ + public String moRefId() { + return this.innerProperties() == null ? null : this.innerProperties().moRefId(); + } + + /** + * Set the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual machine + * template. + * + * @param moRefId the moRefId value to set. + * @return the VirtualMachineTemplateInner object itself. + */ + public VirtualMachineTemplateInner withMoRefId(String moRefId) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineTemplateProperties(); + } + this.innerProperties().withMoRefId(moRefId); + return this; + } + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the virtual machine template. + * + * @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 virtual machine template. + * + * @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 moName property: Gets or sets the vCenter Managed Object name for the virtual machine template. + * + * @return the moName value. + */ + public String moName() { + return this.innerProperties() == null ? null : this.innerProperties().moName(); + } + + /** + * Get the memorySizeMB property: Gets or sets memory size in MBs for the template. + * + * @return the memorySizeMB value. + */ + public Integer memorySizeMB() { + return this.innerProperties() == null ? null : this.innerProperties().memorySizeMB(); + } + + /** + * Get the numCPUs property: Gets or sets the number of vCPUs for the template. + * + * @return the numCPUs value. + */ + public Integer numCPUs() { + return this.innerProperties() == null ? null : this.innerProperties().numCPUs(); + } + + /** + * Get the numCoresPerSocket property: Gets or sets the number of cores per socket for the template. Defaults to 1 + * if unspecified. + * + * @return the numCoresPerSocket value. + */ + public Integer numCoresPerSocket() { + return this.innerProperties() == null ? null : this.innerProperties().numCoresPerSocket(); + } + + /** + * 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 folderPath property: Gets or sets the folder path of the template. + * + * @return the folderPath value. + */ + public String folderPath() { + return this.innerProperties() == null ? null : this.innerProperties().folderPath(); + } + + /** + * 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 the template. + * + * @return the disks value. + */ + public List disks() { + return this.innerProperties() == null ? null : this.innerProperties().disks(); + } + + /** + * Get the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + public String customResourceName() { + return this.innerProperties() == null ? null : this.innerProperties().customResourceName(); + } + + /** + * Get the toolsVersionStatus property: Gets or sets the current version status of VMware Tools installed in the + * guest operating system. + * + * @return the toolsVersionStatus value. + */ + public String toolsVersionStatus() { + return this.innerProperties() == null ? null : this.innerProperties().toolsVersionStatus(); + } + + /** + * Get the toolsVersion property: Gets or sets the current version of VMware Tools. + * + * @return the toolsVersion value. + */ + public String toolsVersion() { + return this.innerProperties() == null ? null : this.innerProperties().toolsVersion(); + } + + /** + * Get the firmwareType property: Firmware type. + * + * @return the firmwareType value. + */ + public FirmwareType firmwareType() { + return this.innerProperties() == null ? null : this.innerProperties().firmwareType(); + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.innerProperties() == null ? null : this.innerProperties().statuses(); + } + + /** + * 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) { + extendedLocation().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualMachineTemplateInner.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VirtualMachineTemplateProperties.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VirtualMachineTemplateProperties.java new file mode 100644 index 000000000000..68a6b8bac827 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VirtualMachineTemplateProperties.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.connectedvmware.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.models.FirmwareType; +import com.azure.resourcemanager.connectedvmware.models.NetworkInterface; +import com.azure.resourcemanager.connectedvmware.models.OsType; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.azure.resourcemanager.connectedvmware.models.VirtualDisk; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Defines the resource properties. */ +@Fluent +public final class VirtualMachineTemplateProperties { + /* + * Gets or sets a unique identifier for this resource. + */ + @JsonProperty(value = "uuid", access = JsonProperty.Access.WRITE_ONLY) + private String uuid; + + /* + * Gets or sets the ARM Id of the vCenter resource in which this template + * resides. + */ + @JsonProperty(value = "vCenterId") + private String vCenterId; + + /* + * Gets or sets the vCenter MoRef (Managed Object Reference) ID for the + * virtual machine + * template. + */ + @JsonProperty(value = "moRefId") + private String moRefId; + + /* + * Gets or sets the inventory Item ID for the virtual machine template. + */ + @JsonProperty(value = "inventoryItemId") + private String inventoryItemId; + + /* + * Gets or sets the vCenter Managed Object name for the virtual machine + * template. + */ + @JsonProperty(value = "moName", access = JsonProperty.Access.WRITE_ONLY) + private String moName; + + /* + * Gets or sets memory size in MBs for the template. + */ + @JsonProperty(value = "memorySizeMB", access = JsonProperty.Access.WRITE_ONLY) + private Integer memorySizeMB; + + /* + * Gets or sets the number of vCPUs for the template. + */ + @JsonProperty(value = "numCPUs", access = JsonProperty.Access.WRITE_ONLY) + private Integer numCPUs; + + /* + * Gets or sets the number of cores per socket for the template. + * Defaults to 1 if unspecified. + */ + @JsonProperty(value = "numCoresPerSocket", access = JsonProperty.Access.WRITE_ONLY) + private Integer numCoresPerSocket; + + /* + * 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 the folder path of the template. + */ + @JsonProperty(value = "folderPath", access = JsonProperty.Access.WRITE_ONLY) + private String folderPath; + + /* + * 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 the template. + */ + @JsonProperty(value = "disks", access = JsonProperty.Access.WRITE_ONLY) + private List disks; + + /* + * Gets the name of the corresponding resource in Kubernetes. + */ + @JsonProperty(value = "customResourceName", access = JsonProperty.Access.WRITE_ONLY) + private String customResourceName; + + /* + * Gets or sets the current version status of VMware Tools installed in the + * guest operating system. + */ + @JsonProperty(value = "toolsVersionStatus", access = JsonProperty.Access.WRITE_ONLY) + private String toolsVersionStatus; + + /* + * Gets or sets the current version of VMware Tools. + */ + @JsonProperty(value = "toolsVersion", access = JsonProperty.Access.WRITE_ONLY) + private String toolsVersion; + + /* + * Firmware type + */ + @JsonProperty(value = "firmwareType", access = JsonProperty.Access.WRITE_ONLY) + private FirmwareType firmwareType; + + /* + * The resource status information. + */ + @JsonProperty(value = "statuses", access = JsonProperty.Access.WRITE_ONLY) + private List statuses; + + /* + * Gets or sets the provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + public String uuid() { + return this.uuid; + } + + /** + * Get the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this template resides. + * + * @return the vCenterId value. + */ + public String vCenterId() { + return this.vCenterId; + } + + /** + * Set the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this template resides. + * + * @param vCenterId the vCenterId value to set. + * @return the VirtualMachineTemplateProperties object itself. + */ + public VirtualMachineTemplateProperties withVCenterId(String vCenterId) { + this.vCenterId = vCenterId; + return this; + } + + /** + * Get the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual machine + * template. + * + * @return the moRefId value. + */ + public String moRefId() { + return this.moRefId; + } + + /** + * Set the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual machine + * template. + * + * @param moRefId the moRefId value to set. + * @return the VirtualMachineTemplateProperties object itself. + */ + public VirtualMachineTemplateProperties withMoRefId(String moRefId) { + this.moRefId = moRefId; + return this; + } + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the virtual machine template. + * + * @return the inventoryItemId value. + */ + public String inventoryItemId() { + return this.inventoryItemId; + } + + /** + * Set the inventoryItemId property: Gets or sets the inventory Item ID for the virtual machine template. + * + * @param inventoryItemId the inventoryItemId value to set. + * @return the VirtualMachineTemplateProperties object itself. + */ + public VirtualMachineTemplateProperties withInventoryItemId(String inventoryItemId) { + this.inventoryItemId = inventoryItemId; + return this; + } + + /** + * Get the moName property: Gets or sets the vCenter Managed Object name for the virtual machine template. + * + * @return the moName value. + */ + public String moName() { + return this.moName; + } + + /** + * Get the memorySizeMB property: Gets or sets memory size in MBs for the template. + * + * @return the memorySizeMB value. + */ + public Integer memorySizeMB() { + return this.memorySizeMB; + } + + /** + * Get the numCPUs property: Gets or sets the number of vCPUs for the template. + * + * @return the numCPUs value. + */ + public Integer numCPUs() { + return this.numCPUs; + } + + /** + * Get the numCoresPerSocket property: Gets or sets the number of cores per socket for the template. Defaults to 1 + * if unspecified. + * + * @return the numCoresPerSocket value. + */ + public Integer numCoresPerSocket() { + return this.numCoresPerSocket; + } + + /** + * 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 folderPath property: Gets or sets the folder path of the template. + * + * @return the folderPath value. + */ + public String folderPath() { + return this.folderPath; + } + + /** + * 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 the template. + * + * @return the disks value. + */ + public List disks() { + return this.disks; + } + + /** + * Get the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + public String customResourceName() { + return this.customResourceName; + } + + /** + * Get the toolsVersionStatus property: Gets or sets the current version status of VMware Tools installed in the + * guest operating system. + * + * @return the toolsVersionStatus value. + */ + public String toolsVersionStatus() { + return this.toolsVersionStatus; + } + + /** + * Get the toolsVersion property: Gets or sets the current version of VMware Tools. + * + * @return the toolsVersion value. + */ + public String toolsVersion() { + return this.toolsVersion; + } + + /** + * Get the firmwareType property: Firmware type. + * + * @return the firmwareType value. + */ + public FirmwareType firmwareType() { + return this.firmwareType; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * 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()); + } + if (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VirtualMachineUpdateProperties.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VirtualMachineUpdateProperties.java new file mode 100644 index 000000000000..0d214baabf33 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VirtualMachineUpdateProperties.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.models.HardwareProfile; +import com.azure.resourcemanager.connectedvmware.models.NetworkProfileUpdate; +import com.azure.resourcemanager.connectedvmware.models.StorageProfileUpdate; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the resource properties. */ +@Fluent +public final class VirtualMachineUpdateProperties { + /* + * Defines the resource properties. + */ + @JsonProperty(value = "hardwareProfile") + private HardwareProfile hardwareProfile; + + /* + * Defines the resource update properties. + */ + @JsonProperty(value = "storageProfile") + private StorageProfileUpdate storageProfile; + + /* + * Defines the update resource properties. + */ + @JsonProperty(value = "networkProfile") + private NetworkProfileUpdate networkProfile; + + /** + * Get the hardwareProfile property: Defines the resource properties. + * + * @return the hardwareProfile value. + */ + public HardwareProfile 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(HardwareProfile hardwareProfile) { + this.hardwareProfile = hardwareProfile; + return this; + } + + /** + * Get the storageProfile property: Defines the resource update properties. + * + * @return the storageProfile value. + */ + public StorageProfileUpdate storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile property: Defines the resource update 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 update resource properties. + * + * @return the networkProfile value. + */ + public NetworkProfileUpdate networkProfile() { + return this.networkProfile; + } + + /** + * Set the networkProfile property: Defines the update resource properties. + * + * @param networkProfile the networkProfile value to set. + * @return the VirtualMachineUpdateProperties object itself. + */ + public VirtualMachineUpdateProperties withNetworkProfile(NetworkProfileUpdate networkProfile) { + this.networkProfile = networkProfile; + 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(); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VirtualNetworkInner.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VirtualNetworkInner.java new file mode 100644 index 000000000000..7f44d0dfb55f --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VirtualNetworkInner.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.models.ExtendedLocation; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Define the virtualNetwork. */ +@Fluent +public final class VirtualNetworkInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties", required = true) + private VirtualNetworkProperties innerProperties = new VirtualNetworkProperties(); + + /* + * Gets or sets the extended location. + */ + @JsonProperty(value = "extendedLocation") + private ExtendedLocation extendedLocation; + + /* + * 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 VirtualNetworkProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the extendedLocation property: Gets or sets the extended location. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: Gets or sets 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; + } + + /** + * 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 VirtualNetworkInner object itself. + */ + public VirtualNetworkInner withKind(String kind) { + this.kind = kind; + 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 uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + public String uuid() { + return this.innerProperties() == null ? null : this.innerProperties().uuid(); + } + + /** + * Get the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this template resides. + * + * @return the vCenterId value. + */ + public String vCenterId() { + return this.innerProperties() == null ? null : this.innerProperties().vCenterId(); + } + + /** + * Set the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this template resides. + * + * @param vCenterId the vCenterId value to set. + * @return the VirtualNetworkInner object itself. + */ + public VirtualNetworkInner withVCenterId(String vCenterId) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualNetworkProperties(); + } + this.innerProperties().withVCenterId(vCenterId); + return this; + } + + /** + * Get the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual network. + * + * @return the moRefId value. + */ + public String moRefId() { + return this.innerProperties() == null ? null : this.innerProperties().moRefId(); + } + + /** + * Set the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual network. + * + * @param moRefId the moRefId value to set. + * @return the VirtualNetworkInner object itself. + */ + public VirtualNetworkInner withMoRefId(String moRefId) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualNetworkProperties(); + } + this.innerProperties().withMoRefId(moRefId); + return this; + } + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the virtual network. + * + * @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 virtual network. + * + * @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 moName property: Gets or sets the vCenter Managed Object name for the virtual network. + * + * @return the moName value. + */ + public String moName() { + return this.innerProperties() == null ? null : this.innerProperties().moName(); + } + + /** + * Get the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + public String customResourceName() { + return this.innerProperties() == null ? null : this.innerProperties().customResourceName(); + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.innerProperties() == null ? null : this.innerProperties().statuses(); + } + + /** + * 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) { + extendedLocation().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualNetworkInner.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VirtualNetworkProperties.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VirtualNetworkProperties.java new file mode 100644 index 000000000000..63a1f05470a7 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/VirtualNetworkProperties.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Defines the resource properties. */ +@Fluent +public final class VirtualNetworkProperties { + /* + * Gets or sets a unique identifier for this resource. + */ + @JsonProperty(value = "uuid", access = JsonProperty.Access.WRITE_ONLY) + private String uuid; + + /* + * Gets or sets the ARM Id of the vCenter resource in which this template + * resides. + */ + @JsonProperty(value = "vCenterId") + private String vCenterId; + + /* + * Gets or sets the vCenter MoRef (Managed Object Reference) ID for the + * virtual network. + */ + @JsonProperty(value = "moRefId") + private String moRefId; + + /* + * Gets or sets the inventory Item ID for the virtual network. + */ + @JsonProperty(value = "inventoryItemId") + private String inventoryItemId; + + /* + * Gets or sets the vCenter Managed Object name for the virtual network. + */ + @JsonProperty(value = "moName", access = JsonProperty.Access.WRITE_ONLY) + private String moName; + + /* + * Gets the name of the corresponding resource in Kubernetes. + */ + @JsonProperty(value = "customResourceName", access = JsonProperty.Access.WRITE_ONLY) + private String customResourceName; + + /* + * The resource status information. + */ + @JsonProperty(value = "statuses", access = JsonProperty.Access.WRITE_ONLY) + private List statuses; + + /* + * Gets or sets the provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + public String uuid() { + return this.uuid; + } + + /** + * Get the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this template resides. + * + * @return the vCenterId value. + */ + public String vCenterId() { + return this.vCenterId; + } + + /** + * Set the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this template resides. + * + * @param vCenterId the vCenterId value to set. + * @return the VirtualNetworkProperties object itself. + */ + public VirtualNetworkProperties withVCenterId(String vCenterId) { + this.vCenterId = vCenterId; + return this; + } + + /** + * Get the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual network. + * + * @return the moRefId value. + */ + public String moRefId() { + return this.moRefId; + } + + /** + * Set the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual network. + * + * @param moRefId the moRefId value to set. + * @return the VirtualNetworkProperties object itself. + */ + public VirtualNetworkProperties withMoRefId(String moRefId) { + this.moRefId = moRefId; + return this; + } + + /** + * Get the inventoryItemId property: Gets or sets the inventory Item ID for the virtual network. + * + * @return the inventoryItemId value. + */ + public String inventoryItemId() { + return this.inventoryItemId; + } + + /** + * Set the inventoryItemId property: Gets or sets the inventory Item ID for the virtual network. + * + * @param inventoryItemId the inventoryItemId value to set. + * @return the VirtualNetworkProperties object itself. + */ + public VirtualNetworkProperties withInventoryItemId(String inventoryItemId) { + this.inventoryItemId = inventoryItemId; + return this; + } + + /** + * Get the moName property: Gets or sets the vCenter Managed Object name for the virtual network. + * + * @return the moName value. + */ + public String moName() { + return this.moName; + } + + /** + * Get the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + public String customResourceName() { + return this.customResourceName; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * 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 (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/package-info.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/models/package-info.java new file mode 100644 index 000000000000..b3b2de9f1489 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/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 ConnectedVMwareClient. Connected VMware Client. */ +package com.azure.resourcemanager.connectedvmware.fluent.models; diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/package-info.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/fluent/package-info.java new file mode 100644 index 000000000000..012d2bb964e6 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/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 ConnectedVMwareClient. Connected VMware Client. */ +package com.azure.resourcemanager.connectedvmware.fluent; diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ClusterImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ClusterImpl.java new file mode 100644 index 000000000000..a52eda53de78 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ClusterImpl.java @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.fluent.models.ClusterInner; +import com.azure.resourcemanager.connectedvmware.models.Cluster; +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; +import com.azure.resourcemanager.connectedvmware.models.ResourcePatch; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ClusterImpl implements Cluster, Cluster.Definition, Cluster.Update { + private ClusterInner innerObject; + + private final com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String uuid() { + return this.innerModel().uuid(); + } + + public String vCenterId() { + return this.innerModel().vCenterId(); + } + + public String moRefId() { + return this.innerModel().moRefId(); + } + + public String inventoryItemId() { + return this.innerModel().inventoryItemId(); + } + + public String moName() { + return this.innerModel().moName(); + } + + public List statuses() { + List inner = this.innerModel().statuses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String customResourceName() { + return this.innerModel().customResourceName(); + } + + public List datastoreIds() { + List inner = this.innerModel().datastoreIds(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List networkIds() { + List inner = this.innerModel().networkIds(); + 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 ClusterInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String clusterName; + + private ResourcePatch updateBody; + + public ClusterImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Cluster create() { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .create(resourceGroupName, clusterName, this.innerModel(), Context.NONE); + return this; + } + + public Cluster create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .create(resourceGroupName, clusterName, this.innerModel(), context); + return this; + } + + ClusterImpl(String name, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerObject = new ClusterInner(); + this.serviceManager = serviceManager; + this.clusterName = name; + } + + public ClusterImpl update() { + this.updateBody = new ResourcePatch(); + return this; + } + + public Cluster apply() { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .updateWithResponse(resourceGroupName, clusterName, updateBody, Context.NONE) + .getValue(); + return this; + } + + public Cluster apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .updateWithResponse(resourceGroupName, clusterName, updateBody, context) + .getValue(); + return this; + } + + ClusterImpl( + ClusterInner innerObject, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.clusterName = Utils.getValueFromIdByName(innerObject.id(), "clusters"); + } + + public Cluster refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .getByResourceGroupWithResponse(resourceGroupName, clusterName, Context.NONE) + .getValue(); + return this; + } + + public Cluster refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getClusters() + .getByResourceGroupWithResponse(resourceGroupName, clusterName, context) + .getValue(); + return this; + } + + public ClusterImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ClusterImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ClusterImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public ClusterImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public ClusterImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } + + public ClusterImpl withVCenterId(String vCenterId) { + this.innerModel().withVCenterId(vCenterId); + return this; + } + + public ClusterImpl withMoRefId(String moRefId) { + this.innerModel().withMoRefId(moRefId); + return this; + } + + public ClusterImpl withInventoryItemId(String inventoryItemId) { + this.innerModel().withInventoryItemId(inventoryItemId); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ClustersClientImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ClustersClientImpl.java new file mode 100644 index 000000000000..1ea5ea50df7e --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ClustersClientImpl.java @@ -0,0 +1,1521 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.ClustersClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.ClusterInner; +import com.azure.resourcemanager.connectedvmware.models.ClustersList; +import com.azure.resourcemanager.connectedvmware.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 ClustersClient. */ +public final class ClustersClientImpl implements ClustersClient { + /** The proxy service used to perform REST calls. */ + private final ClustersService service; + + /** The service client containing this operation class. */ + private final ConnectedVMwareClientImpl client; + + /** + * Initializes an instance of ClustersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ClustersClientImpl(ConnectedVMwareClientImpl client) { + this.service = RestProxy.create(ClustersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConnectedVMwareClientClusters to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConnectedVMwareClien") + private interface ClustersService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/clusters/{clusterName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ClusterInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/clusters/{clusterName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/clusters/{clusterName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResourcePatch body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/clusters/{clusterName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterName") String clusterName, + @QueryParam("api-version") String apiVersion, + @QueryParam("force") Boolean force, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/clusters") + @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( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/clusters") + @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("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create Or Update cluster. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @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 define the cluster along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String clusterName, ClusterInner 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create Or Update cluster. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @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 define the cluster along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String clusterName, ClusterInner 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Create Or Update cluster. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @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 define the cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ClusterInner> beginCreateAsync( + String resourceGroupName, String clusterName, ClusterInner body) { + Mono>> mono = createWithResponseAsync(resourceGroupName, clusterName, body); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ClusterInner.class, ClusterInner.class, this.client.getContext()); + } + + /** + * Create Or Update cluster. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @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 define the cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ClusterInner> beginCreateAsync( + String resourceGroupName, String clusterName, ClusterInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createWithResponseAsync(resourceGroupName, clusterName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ClusterInner.class, ClusterInner.class, context); + } + + /** + * Create Or Update cluster. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @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 define the cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ClusterInner> beginCreate( + String resourceGroupName, String clusterName, ClusterInner body) { + return beginCreateAsync(resourceGroupName, clusterName, body).getSyncPoller(); + } + + /** + * Create Or Update cluster. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @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 define the cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ClusterInner> beginCreate( + String resourceGroupName, String clusterName, ClusterInner body, Context context) { + return beginCreateAsync(resourceGroupName, clusterName, body, context).getSyncPoller(); + } + + /** + * Create Or Update cluster. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @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 define the cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String clusterName, ClusterInner body) { + return beginCreateAsync(resourceGroupName, clusterName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update cluster. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String clusterName) { + final ClusterInner body = null; + return beginCreateAsync(resourceGroupName, clusterName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update cluster. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @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 define the cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String clusterName, ClusterInner body, Context context) { + return beginCreateAsync(resourceGroupName, clusterName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update cluster. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @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 define the cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterInner create(String resourceGroupName, String clusterName, ClusterInner body) { + return createAsync(resourceGroupName, clusterName, body).block(); + } + + /** + * Create Or Update cluster. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterInner create(String resourceGroupName, String clusterName) { + final ClusterInner body = null; + return createAsync(resourceGroupName, clusterName, body).block(); + } + + /** + * Create Or Update cluster. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @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 define the cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterInner create(String resourceGroupName, String clusterName, ClusterInner body, Context context) { + return createAsync(resourceGroupName, clusterName, body, context).block(); + } + + /** + * Implements cluster GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the cluster along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String clusterName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements cluster GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the cluster along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Implements cluster GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String clusterName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, clusterName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Implements cluster GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterInner getByResourceGroup(String resourceGroupName, String clusterName) { + return getByResourceGroupAsync(resourceGroupName, clusterName).block(); + } + + /** + * Implements cluster GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the cluster along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String clusterName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, clusterName, context).block(); + } + + /** + * API to update certain properties of the cluster resource. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param body Resource properties to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the cluster along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String clusterName, ResourcePatch 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * API to update certain properties of the cluster resource. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the cluster along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String clusterName, 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * API to update certain properties of the cluster resource. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param body Resource properties to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String clusterName, ResourcePatch body) { + return updateWithResponseAsync(resourceGroupName, clusterName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * API to update certain properties of the cluster resource. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String clusterName) { + final ResourcePatch body = null; + return updateWithResponseAsync(resourceGroupName, clusterName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * API to update certain properties of the cluster resource. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ClusterInner update(String resourceGroupName, String clusterName) { + final ResourcePatch body = null; + return updateAsync(resourceGroupName, clusterName, body).block(); + } + + /** + * API to update certain properties of the cluster resource. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the cluster along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String clusterName, ResourcePatch body, Context context) { + return updateWithResponseAsync(resourceGroupName, clusterName, body, context).block(); + } + + /** + * Implements cluster DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterName, + this.client.getApiVersion(), + force, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements cluster DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 clusterName, 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 (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName 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, + clusterName, + this.client.getApiVersion(), + force, + accept, + context); + } + + /** + * Implements cluster DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 clusterName, Boolean force) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, clusterName, force); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Implements cluster DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 clusterName, Boolean force, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, clusterName, force, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Implements cluster DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 clusterName, Boolean force) { + return beginDeleteAsync(resourceGroupName, clusterName, force).getSyncPoller(); + } + + /** + * Implements cluster DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 clusterName, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, clusterName, force, context).getSyncPoller(); + } + + /** + * Implements cluster DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 clusterName, Boolean force) { + return beginDeleteAsync(resourceGroupName, clusterName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Implements cluster DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 clusterName) { + final Boolean force = null; + return beginDeleteAsync(resourceGroupName, clusterName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Implements cluster DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 clusterName, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, clusterName, force, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Implements cluster DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 clusterName, Boolean force) { + deleteAsync(resourceGroupName, clusterName, force).block(); + } + + /** + * Implements cluster DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 clusterName) { + final Boolean force = null; + deleteAsync(resourceGroupName, clusterName, force).block(); + } + + /** + * Implements cluster DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 clusterName, Boolean force, Context context) { + deleteAsync(resourceGroupName, clusterName, force, context).block(); + } + + /** + * List of clusters 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 Clusters 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 clusters 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 Clusters 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 clusters 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 Clusters as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List of clusters 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 Clusters as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List of clusters 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 Clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List of clusters 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 Clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List of clusters in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Clusters 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 clusters in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Clusters 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 clusters in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Clusters 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 clusters in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Clusters 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 clusters in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List of clusters in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Clusters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Clusters 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 list of Clusters along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Clusters 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 Clusters along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ClustersImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ClustersImpl.java new file mode 100644 index 000000000000..565d4f69c0b3 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ClustersImpl.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.ClustersClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.ClusterInner; +import com.azure.resourcemanager.connectedvmware.models.Cluster; +import com.azure.resourcemanager.connectedvmware.models.Clusters; + +public final class ClustersImpl implements Clusters { + private static final ClientLogger LOGGER = new ClientLogger(ClustersImpl.class); + + private final ClustersClient innerClient; + + private final com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager; + + public ClustersImpl( + ClustersClient innerClient, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Cluster getByResourceGroup(String resourceGroupName, String clusterName) { + ClusterInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, clusterName); + if (inner != null) { + return new ClusterImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String clusterName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, clusterName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ClusterImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String clusterName, Boolean force) { + this.serviceClient().delete(resourceGroupName, clusterName, force); + } + + public void delete(String resourceGroupName, String clusterName) { + this.serviceClient().delete(resourceGroupName, clusterName); + } + + public void delete(String resourceGroupName, String clusterName, Boolean force, Context context) { + this.serviceClient().delete(resourceGroupName, clusterName, force, context); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ClusterImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ClusterImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ClusterImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ClusterImpl(inner1, this.manager())); + } + + public Cluster 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 clusterName = Utils.getValueFromIdByName(id, "clusters"); + if (clusterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'clusters'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, clusterName, 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 clusterName = Utils.getValueFromIdByName(id, "clusters"); + if (clusterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'clusters'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, clusterName, 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 clusterName = Utils.getValueFromIdByName(id, "clusters"); + if (clusterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'clusters'.", id))); + } + Boolean localForce = null; + this.delete(resourceGroupName, clusterName, 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 clusterName = Utils.getValueFromIdByName(id, "clusters"); + if (clusterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'clusters'.", id))); + } + this.delete(resourceGroupName, clusterName, force, context); + } + + private ClustersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } + + public ClusterImpl define(String name) { + return new ClusterImpl(name, this.manager()); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ConnectedVMwareClientBuilder.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ConnectedVMwareClientBuilder.java new file mode 100644 index 000000000000..548ca0a9579e --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ConnectedVMwareClientBuilder.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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 ConnectedVMwareClientImpl type. */ +@ServiceClientBuilder(serviceClients = {ConnectedVMwareClientImpl.class}) +public final class ConnectedVMwareClientBuilder { + /* + * The Subscription ID. + */ + private String subscriptionId; + + /** + * Sets The Subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the ConnectedVMwareClientBuilder. + */ + public ConnectedVMwareClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the ConnectedVMwareClientBuilder. + */ + public ConnectedVMwareClientBuilder 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 ConnectedVMwareClientBuilder. + */ + public ConnectedVMwareClientBuilder 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 ConnectedVMwareClientBuilder. + */ + public ConnectedVMwareClientBuilder 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 ConnectedVMwareClientBuilder. + */ + public ConnectedVMwareClientBuilder 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 ConnectedVMwareClientBuilder. + */ + public ConnectedVMwareClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ConnectedVMwareClientImpl with the provided parameters. + * + * @return an instance of ConnectedVMwareClientImpl. + */ + public ConnectedVMwareClientImpl 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(); + } + ConnectedVMwareClientImpl client = + new ConnectedVMwareClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ConnectedVMwareClientImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ConnectedVMwareClientImpl.java new file mode 100644 index 000000000000..e05047418148 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ConnectedVMwareClientImpl.java @@ -0,0 +1,461 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.ClustersClient; +import com.azure.resourcemanager.connectedvmware.fluent.ConnectedVMwareClient; +import com.azure.resourcemanager.connectedvmware.fluent.DatastoresClient; +import com.azure.resourcemanager.connectedvmware.fluent.GuestAgentsClient; +import com.azure.resourcemanager.connectedvmware.fluent.HostsClient; +import com.azure.resourcemanager.connectedvmware.fluent.HybridIdentityMetadatasClient; +import com.azure.resourcemanager.connectedvmware.fluent.InventoryItemsClient; +import com.azure.resourcemanager.connectedvmware.fluent.MachineExtensionsClient; +import com.azure.resourcemanager.connectedvmware.fluent.OperationsClient; +import com.azure.resourcemanager.connectedvmware.fluent.ResourcePoolsClient; +import com.azure.resourcemanager.connectedvmware.fluent.VCentersClient; +import com.azure.resourcemanager.connectedvmware.fluent.VirtualMachineTemplatesClient; +import com.azure.resourcemanager.connectedvmware.fluent.VirtualMachinesClient; +import com.azure.resourcemanager.connectedvmware.fluent.VirtualNetworksClient; +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 ConnectedVMwareClientImpl type. */ +@ServiceClient(builder = ConnectedVMwareClientBuilder.class) +public final class ConnectedVMwareClientImpl implements ConnectedVMwareClient { + /** The Subscription ID. */ + private final String subscriptionId; + + /** + * Gets The Subscription ID. + * + * @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 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 ResourcePoolsClient object to access its operations. */ + private final ResourcePoolsClient resourcePools; + + /** + * Gets the ResourcePoolsClient object to access its operations. + * + * @return the ResourcePoolsClient object. + */ + public ResourcePoolsClient getResourcePools() { + return this.resourcePools; + } + + /** The ClustersClient object to access its operations. */ + private final ClustersClient clusters; + + /** + * Gets the ClustersClient object to access its operations. + * + * @return the ClustersClient object. + */ + public ClustersClient getClusters() { + return this.clusters; + } + + /** The HostsClient object to access its operations. */ + private final HostsClient hosts; + + /** + * Gets the HostsClient object to access its operations. + * + * @return the HostsClient object. + */ + public HostsClient getHosts() { + return this.hosts; + } + + /** The DatastoresClient object to access its operations. */ + private final DatastoresClient datastores; + + /** + * Gets the DatastoresClient object to access its operations. + * + * @return the DatastoresClient object. + */ + public DatastoresClient getDatastores() { + return this.datastores; + } + + /** The VCentersClient object to access its operations. */ + private final VCentersClient vCenters; + + /** + * Gets the VCentersClient object to access its operations. + * + * @return the VCentersClient object. + */ + public VCentersClient getVCenters() { + return this.vCenters; + } + + /** 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 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 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; + } + + /** The HybridIdentityMetadatasClient object to access its operations. */ + private final HybridIdentityMetadatasClient hybridIdentityMetadatas; + + /** + * Gets the HybridIdentityMetadatasClient object to access its operations. + * + * @return the HybridIdentityMetadatasClient object. + */ + public HybridIdentityMetadatasClient getHybridIdentityMetadatas() { + return this.hybridIdentityMetadatas; + } + + /** The MachineExtensionsClient object to access its operations. */ + private final MachineExtensionsClient machineExtensions; + + /** + * Gets the MachineExtensionsClient object to access its operations. + * + * @return the MachineExtensionsClient object. + */ + public MachineExtensionsClient getMachineExtensions() { + return this.machineExtensions; + } + + /** The GuestAgentsClient object to access its operations. */ + private final GuestAgentsClient guestAgents; + + /** + * Gets the GuestAgentsClient object to access its operations. + * + * @return the GuestAgentsClient object. + */ + public GuestAgentsClient getGuestAgents() { + return this.guestAgents; + } + + /** + * Initializes an instance of ConnectedVMwareClient 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 Subscription ID. + * @param endpoint server parameter. + */ + ConnectedVMwareClientImpl( + 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-10-01-preview"; + this.operations = new OperationsClientImpl(this); + this.resourcePools = new ResourcePoolsClientImpl(this); + this.clusters = new ClustersClientImpl(this); + this.hosts = new HostsClientImpl(this); + this.datastores = new DatastoresClientImpl(this); + this.vCenters = new VCentersClientImpl(this); + this.virtualMachines = new VirtualMachinesClientImpl(this); + this.virtualMachineTemplates = new VirtualMachineTemplatesClientImpl(this); + this.virtualNetworks = new VirtualNetworksClientImpl(this); + this.inventoryItems = new InventoryItemsClientImpl(this); + this.hybridIdentityMetadatas = new HybridIdentityMetadatasClientImpl(this); + this.machineExtensions = new MachineExtensionsClientImpl(this); + this.guestAgents = new GuestAgentsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + 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(ConnectedVMwareClientImpl.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/DatastoreImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/DatastoreImpl.java new file mode 100644 index 000000000000..d4abe51180b7 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/DatastoreImpl.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.fluent.models.DatastoreInner; +import com.azure.resourcemanager.connectedvmware.models.Datastore; +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; +import com.azure.resourcemanager.connectedvmware.models.ProvisioningState; +import com.azure.resourcemanager.connectedvmware.models.ResourcePatch; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class DatastoreImpl implements Datastore, Datastore.Definition, Datastore.Update { + private DatastoreInner innerObject; + + private final com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String uuid() { + return this.innerModel().uuid(); + } + + public String vCenterId() { + return this.innerModel().vCenterId(); + } + + public String moRefId() { + return this.innerModel().moRefId(); + } + + public String inventoryItemId() { + return this.innerModel().inventoryItemId(); + } + + public String moName() { + return this.innerModel().moName(); + } + + public List statuses() { + List inner = this.innerModel().statuses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String customResourceName() { + return this.innerModel().customResourceName(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public DatastoreInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String datastoreName; + + private ResourcePatch updateBody; + + public DatastoreImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Datastore create() { + this.innerObject = + serviceManager + .serviceClient() + .getDatastores() + .create(resourceGroupName, datastoreName, this.innerModel(), Context.NONE); + return this; + } + + public Datastore create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatastores() + .create(resourceGroupName, datastoreName, this.innerModel(), context); + return this; + } + + DatastoreImpl(String name, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerObject = new DatastoreInner(); + this.serviceManager = serviceManager; + this.datastoreName = name; + } + + public DatastoreImpl update() { + this.updateBody = new ResourcePatch(); + return this; + } + + public Datastore apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDatastores() + .updateWithResponse(resourceGroupName, datastoreName, updateBody, Context.NONE) + .getValue(); + return this; + } + + public Datastore apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatastores() + .updateWithResponse(resourceGroupName, datastoreName, updateBody, context) + .getValue(); + return this; + } + + DatastoreImpl( + DatastoreInner innerObject, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.datastoreName = Utils.getValueFromIdByName(innerObject.id(), "datastores"); + } + + public Datastore refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDatastores() + .getByResourceGroupWithResponse(resourceGroupName, datastoreName, Context.NONE) + .getValue(); + return this; + } + + public Datastore refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatastores() + .getByResourceGroupWithResponse(resourceGroupName, datastoreName, context) + .getValue(); + return this; + } + + public DatastoreImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DatastoreImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DatastoreImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public DatastoreImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public DatastoreImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } + + public DatastoreImpl withVCenterId(String vCenterId) { + this.innerModel().withVCenterId(vCenterId); + return this; + } + + public DatastoreImpl withMoRefId(String moRefId) { + this.innerModel().withMoRefId(moRefId); + return this; + } + + public DatastoreImpl withInventoryItemId(String inventoryItemId) { + this.innerModel().withInventoryItemId(inventoryItemId); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/DatastoresClientImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/DatastoresClientImpl.java new file mode 100644 index 000000000000..5f9b0a1705c6 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/DatastoresClientImpl.java @@ -0,0 +1,1530 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.DatastoresClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.DatastoreInner; +import com.azure.resourcemanager.connectedvmware.models.DatastoresList; +import com.azure.resourcemanager.connectedvmware.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 DatastoresClient. */ +public final class DatastoresClientImpl implements DatastoresClient { + /** The proxy service used to perform REST calls. */ + private final DatastoresService service; + + /** The service client containing this operation class. */ + private final ConnectedVMwareClientImpl client; + + /** + * Initializes an instance of DatastoresClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatastoresClientImpl(ConnectedVMwareClientImpl client) { + this.service = + RestProxy.create(DatastoresService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConnectedVMwareClientDatastores to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConnectedVMwareClien") + private interface DatastoresService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/datastores/{datastoreName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("datastoreName") String datastoreName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatastoreInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/datastores/{datastoreName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("datastoreName") String datastoreName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/datastores/{datastoreName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("datastoreName") String datastoreName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResourcePatch body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/datastores/{datastoreName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("datastoreName") String datastoreName, + @QueryParam("api-version") String apiVersion, + @QueryParam("force") Boolean force, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/datastores") + @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( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/datastores") + @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("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create Or Update datastore. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @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 define the datastore along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String datastoreName, DatastoreInner 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 (datastoreName == null) { + return Mono.error(new IllegalArgumentException("Parameter datastoreName 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, + datastoreName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create Or Update datastore. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @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 define the datastore along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String datastoreName, DatastoreInner 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 (datastoreName == null) { + return Mono.error(new IllegalArgumentException("Parameter datastoreName 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, + datastoreName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Create Or Update datastore. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @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 define the datastore. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DatastoreInner> beginCreateAsync( + String resourceGroupName, String datastoreName, DatastoreInner body) { + Mono>> mono = createWithResponseAsync(resourceGroupName, datastoreName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DatastoreInner.class, + DatastoreInner.class, + this.client.getContext()); + } + + /** + * Create Or Update datastore. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @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 define the datastore. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DatastoreInner> beginCreateAsync( + String resourceGroupName, String datastoreName, DatastoreInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, datastoreName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DatastoreInner.class, DatastoreInner.class, context); + } + + /** + * Create Or Update datastore. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @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 define the datastore. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DatastoreInner> beginCreate( + String resourceGroupName, String datastoreName, DatastoreInner body) { + return beginCreateAsync(resourceGroupName, datastoreName, body).getSyncPoller(); + } + + /** + * Create Or Update datastore. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @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 define the datastore. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DatastoreInner> beginCreate( + String resourceGroupName, String datastoreName, DatastoreInner body, Context context) { + return beginCreateAsync(resourceGroupName, datastoreName, body, context).getSyncPoller(); + } + + /** + * Create Or Update datastore. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @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 define the datastore on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String datastoreName, DatastoreInner body) { + return beginCreateAsync(resourceGroupName, datastoreName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update datastore. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the datastore on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String datastoreName) { + final DatastoreInner body = null; + return beginCreateAsync(resourceGroupName, datastoreName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update datastore. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @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 define the datastore on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String datastoreName, DatastoreInner body, Context context) { + return beginCreateAsync(resourceGroupName, datastoreName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update datastore. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @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 define the datastore. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatastoreInner create(String resourceGroupName, String datastoreName, DatastoreInner body) { + return createAsync(resourceGroupName, datastoreName, body).block(); + } + + /** + * Create Or Update datastore. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the datastore. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatastoreInner create(String resourceGroupName, String datastoreName) { + final DatastoreInner body = null; + return createAsync(resourceGroupName, datastoreName, body).block(); + } + + /** + * Create Or Update datastore. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @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 define the datastore. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatastoreInner create(String resourceGroupName, String datastoreName, DatastoreInner body, Context context) { + return createAsync(resourceGroupName, datastoreName, body, context).block(); + } + + /** + * Implements datastore GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the datastore along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String datastoreName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (datastoreName == null) { + return Mono.error(new IllegalArgumentException("Parameter datastoreName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + datastoreName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements datastore GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the datastore along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String datastoreName, 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 (datastoreName == null) { + return Mono.error(new IllegalArgumentException("Parameter datastoreName 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, + datastoreName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Implements datastore GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the datastore on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String datastoreName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, datastoreName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Implements datastore GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the datastore. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatastoreInner getByResourceGroup(String resourceGroupName, String datastoreName) { + return getByResourceGroupAsync(resourceGroupName, datastoreName).block(); + } + + /** + * Implements datastore GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the datastore along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String datastoreName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, datastoreName, context).block(); + } + + /** + * API to update certain properties of the datastore resource. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param body Resource properties to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the datastore along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String datastoreName, ResourcePatch 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 (datastoreName == null) { + return Mono.error(new IllegalArgumentException("Parameter datastoreName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + datastoreName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * API to update certain properties of the datastore resource. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the datastore along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String datastoreName, 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (datastoreName == null) { + return Mono.error(new IllegalArgumentException("Parameter datastoreName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + datastoreName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * API to update certain properties of the datastore resource. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param body Resource properties to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the datastore on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String datastoreName, ResourcePatch body) { + return updateWithResponseAsync(resourceGroupName, datastoreName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * API to update certain properties of the datastore resource. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the datastore on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String datastoreName) { + final ResourcePatch body = null; + return updateWithResponseAsync(resourceGroupName, datastoreName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * API to update certain properties of the datastore resource. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the datastore. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatastoreInner update(String resourceGroupName, String datastoreName) { + final ResourcePatch body = null; + return updateAsync(resourceGroupName, datastoreName, body).block(); + } + + /** + * API to update certain properties of the datastore resource. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the datastore along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String datastoreName, ResourcePatch body, Context context) { + return updateWithResponseAsync(resourceGroupName, datastoreName, body, context).block(); + } + + /** + * Implements datastore DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 datastoreName, 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 (datastoreName == null) { + return Mono.error(new IllegalArgumentException("Parameter datastoreName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + datastoreName, + this.client.getApiVersion(), + force, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements datastore DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 datastoreName, 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 (datastoreName == null) { + return Mono.error(new IllegalArgumentException("Parameter datastoreName 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, + datastoreName, + this.client.getApiVersion(), + force, + accept, + context); + } + + /** + * Implements datastore DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 datastoreName, Boolean force) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, datastoreName, force); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Implements datastore DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 datastoreName, Boolean force, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, datastoreName, force, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Implements datastore DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 datastoreName, Boolean force) { + return beginDeleteAsync(resourceGroupName, datastoreName, force).getSyncPoller(); + } + + /** + * Implements datastore DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 datastoreName, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, datastoreName, force, context).getSyncPoller(); + } + + /** + * Implements datastore DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 datastoreName, Boolean force) { + return beginDeleteAsync(resourceGroupName, datastoreName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Implements datastore DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 datastoreName) { + final Boolean force = null; + return beginDeleteAsync(resourceGroupName, datastoreName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Implements datastore DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 datastoreName, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, datastoreName, force, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Implements datastore DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 datastoreName, Boolean force) { + deleteAsync(resourceGroupName, datastoreName, force).block(); + } + + /** + * Implements datastore DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 datastoreName) { + final Boolean force = null; + deleteAsync(resourceGroupName, datastoreName, force).block(); + } + + /** + * Implements datastore DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 datastoreName, Boolean force, Context context) { + deleteAsync(resourceGroupName, datastoreName, force, context).block(); + } + + /** + * List of datastores 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 Datastores 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 datastores 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 Datastores 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 datastores 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 Datastores as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List of datastores 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 Datastores as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List of datastores 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 Datastores as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List of datastores 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 Datastores as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List of datastores in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Datastores 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 datastores in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Datastores 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 datastores in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Datastores 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 datastores in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Datastores 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 datastores in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Datastores as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List of datastores in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Datastores as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Datastores 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 list of Datastores along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Datastores 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 Datastores along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/DatastoresImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/DatastoresImpl.java new file mode 100644 index 000000000000..3d0b0785914e --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/DatastoresImpl.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.DatastoresClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.DatastoreInner; +import com.azure.resourcemanager.connectedvmware.models.Datastore; +import com.azure.resourcemanager.connectedvmware.models.Datastores; + +public final class DatastoresImpl implements Datastores { + private static final ClientLogger LOGGER = new ClientLogger(DatastoresImpl.class); + + private final DatastoresClient innerClient; + + private final com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager; + + public DatastoresImpl( + DatastoresClient innerClient, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Datastore getByResourceGroup(String resourceGroupName, String datastoreName) { + DatastoreInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, datastoreName); + if (inner != null) { + return new DatastoreImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String datastoreName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, datastoreName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatastoreImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String datastoreName, Boolean force) { + this.serviceClient().delete(resourceGroupName, datastoreName, force); + } + + public void delete(String resourceGroupName, String datastoreName) { + this.serviceClient().delete(resourceGroupName, datastoreName); + } + + public void delete(String resourceGroupName, String datastoreName, Boolean force, Context context) { + this.serviceClient().delete(resourceGroupName, datastoreName, force, context); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new DatastoreImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new DatastoreImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new DatastoreImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new DatastoreImpl(inner1, this.manager())); + } + + public Datastore 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 datastoreName = Utils.getValueFromIdByName(id, "datastores"); + if (datastoreName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'datastores'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, datastoreName, 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 datastoreName = Utils.getValueFromIdByName(id, "datastores"); + if (datastoreName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'datastores'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, datastoreName, 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 datastoreName = Utils.getValueFromIdByName(id, "datastores"); + if (datastoreName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'datastores'.", id))); + } + Boolean localForce = null; + this.delete(resourceGroupName, datastoreName, 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 datastoreName = Utils.getValueFromIdByName(id, "datastores"); + if (datastoreName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'datastores'.", id))); + } + this.delete(resourceGroupName, datastoreName, force, context); + } + + private DatastoresClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } + + public DatastoreImpl define(String name) { + return new DatastoreImpl(name, this.manager()); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/GuestAgentImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/GuestAgentImpl.java new file mode 100644 index 000000000000..20f8858b92e5 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/GuestAgentImpl.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.fluent.models.GuestAgentInner; +import com.azure.resourcemanager.connectedvmware.models.GuestAgent; +import com.azure.resourcemanager.connectedvmware.models.GuestCredential; +import com.azure.resourcemanager.connectedvmware.models.HttpProxyConfiguration; +import com.azure.resourcemanager.connectedvmware.models.ProvisioningAction; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import java.util.Collections; +import java.util.List; + +public final class GuestAgentImpl implements GuestAgent, GuestAgent.Definition { + private GuestAgentInner innerObject; + + private final com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager; + + GuestAgentImpl( + GuestAgentInner innerObject, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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 uuid() { + return this.innerModel().uuid(); + } + + public GuestCredential credentials() { + return this.innerModel().credentials(); + } + + public HttpProxyConfiguration httpProxyConfig() { + return this.innerModel().httpProxyConfig(); + } + + public ProvisioningAction provisioningAction() { + return this.innerModel().provisioningAction(); + } + + public String status() { + return this.innerModel().status(); + } + + public String customResourceName() { + return this.innerModel().customResourceName(); + } + + public List statuses() { + List inner = this.innerModel().statuses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public GuestAgentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String virtualMachineName; + + private String name; + + public GuestAgentImpl withExistingVirtualMachine(String resourceGroupName, String virtualMachineName) { + this.resourceGroupName = resourceGroupName; + this.virtualMachineName = virtualMachineName; + return this; + } + + public GuestAgent create() { + this.innerObject = + serviceManager + .serviceClient() + .getGuestAgents() + .create(resourceGroupName, virtualMachineName, name, this.innerModel(), Context.NONE); + return this; + } + + public GuestAgent create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGuestAgents() + .create(resourceGroupName, virtualMachineName, name, this.innerModel(), context); + return this; + } + + GuestAgentImpl(String name, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerObject = new GuestAgentInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public GuestAgent refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getGuestAgents() + .getWithResponse(resourceGroupName, virtualMachineName, name, Context.NONE) + .getValue(); + return this; + } + + public GuestAgent refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGuestAgents() + .getWithResponse(resourceGroupName, virtualMachineName, name, context) + .getValue(); + return this; + } + + public GuestAgentImpl withCredentials(GuestCredential credentials) { + this.innerModel().withCredentials(credentials); + return this; + } + + public GuestAgentImpl withHttpProxyConfig(HttpProxyConfiguration httpProxyConfig) { + this.innerModel().withHttpProxyConfig(httpProxyConfig); + return this; + } + + public GuestAgentImpl withProvisioningAction(ProvisioningAction provisioningAction) { + this.innerModel().withProvisioningAction(provisioningAction); + return this; + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/GuestAgentsClientImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/GuestAgentsClientImpl.java new file mode 100644 index 000000000000..569417b223bb --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/GuestAgentsClientImpl.java @@ -0,0 +1,1130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.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.connectedvmware.fluent.GuestAgentsClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.GuestAgentInner; +import com.azure.resourcemanager.connectedvmware.models.GuestAgentList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in GuestAgentsClient. */ +public final class GuestAgentsClientImpl implements GuestAgentsClient { + /** The proxy service used to perform REST calls. */ + private final GuestAgentsService service; + + /** The service client containing this operation class. */ + private final ConnectedVMwareClientImpl client; + + /** + * Initializes an instance of GuestAgentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GuestAgentsClientImpl(ConnectedVMwareClientImpl client) { + this.service = + RestProxy.create(GuestAgentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConnectedVMwareClientGuestAgents to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConnectedVMwareClien") + private interface GuestAgentsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualMachineName") String virtualMachineName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GuestAgentInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualMachineName") String virtualMachineName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}") + @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, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByVm( + @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"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByVmNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create Or Update GuestAgent. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the guestAgents. + * @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 GuestAgent along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String virtualMachineName, String name, GuestAgentInner 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name 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, + virtualMachineName, + name, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create Or Update GuestAgent. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the guestAgents. + * @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 GuestAgent along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String virtualMachineName, String name, GuestAgentInner 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name 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, + virtualMachineName, + name, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Create Or Update GuestAgent. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the guestAgents. + * @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 defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GuestAgentInner> beginCreateAsync( + String resourceGroupName, String virtualMachineName, String name, GuestAgentInner body) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, virtualMachineName, name, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + GuestAgentInner.class, + GuestAgentInner.class, + this.client.getContext()); + } + + /** + * Create Or Update GuestAgent. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the guestAgents. + * @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 defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GuestAgentInner> beginCreateAsync( + String resourceGroupName, String virtualMachineName, String name, GuestAgentInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, virtualMachineName, name, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), GuestAgentInner.class, GuestAgentInner.class, context); + } + + /** + * Create Or Update GuestAgent. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the guestAgents. + * @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 defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GuestAgentInner> beginCreate( + String resourceGroupName, String virtualMachineName, String name, GuestAgentInner body) { + return beginCreateAsync(resourceGroupName, virtualMachineName, name, body).getSyncPoller(); + } + + /** + * Create Or Update GuestAgent. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the guestAgents. + * @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 defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GuestAgentInner> beginCreate( + String resourceGroupName, String virtualMachineName, String name, GuestAgentInner body, Context context) { + return beginCreateAsync(resourceGroupName, virtualMachineName, name, body, context).getSyncPoller(); + } + + /** + * Create Or Update GuestAgent. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the guestAgents. + * @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 GuestAgent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String virtualMachineName, String name, GuestAgentInner body) { + return beginCreateAsync(resourceGroupName, virtualMachineName, name, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update GuestAgent. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the guestAgents. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the GuestAgent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String virtualMachineName, String name) { + final GuestAgentInner body = null; + return beginCreateAsync(resourceGroupName, virtualMachineName, name, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update GuestAgent. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the guestAgents. + * @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 GuestAgent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String virtualMachineName, String name, GuestAgentInner body, Context context) { + return beginCreateAsync(resourceGroupName, virtualMachineName, name, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update GuestAgent. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the guestAgents. + * @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 GuestAgent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GuestAgentInner create( + String resourceGroupName, String virtualMachineName, String name, GuestAgentInner body) { + return createAsync(resourceGroupName, virtualMachineName, name, body).block(); + } + + /** + * Create Or Update GuestAgent. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the guestAgents. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GuestAgentInner create(String resourceGroupName, String virtualMachineName, String name) { + final GuestAgentInner body = null; + return createAsync(resourceGroupName, virtualMachineName, name, body).block(); + } + + /** + * Create Or Update GuestAgent. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the guestAgents. + * @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 GuestAgent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GuestAgentInner create( + String resourceGroupName, String virtualMachineName, String name, GuestAgentInner body, Context context) { + return createAsync(resourceGroupName, virtualMachineName, name, body, context).block(); + } + + /** + * Implements GuestAgent GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the GuestAgent along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String virtualMachineName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + name, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements GuestAgent GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the GuestAgent along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String virtualMachineName, String name, 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name 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, + virtualMachineName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Implements GuestAgent GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the GuestAgent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String virtualMachineName, String name) { + return getWithResponseAsync(resourceGroupName, virtualMachineName, name) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Implements GuestAgent GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GuestAgentInner get(String resourceGroupName, String virtualMachineName, String name) { + return getAsync(resourceGroupName, virtualMachineName, name).block(); + } + + /** + * Implements GuestAgent GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the GuestAgent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String virtualMachineName, String name, Context context) { + return getWithResponseAsync(resourceGroupName, virtualMachineName, name, context).block(); + } + + /** + * Implements GuestAgent DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name 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, + name, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements GuestAgent DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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, String name, 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name 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, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Implements GuestAgent DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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, String name) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, virtualMachineName, name); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Implements GuestAgent DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, virtualMachineName, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Implements GuestAgent DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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, String name) { + return beginDeleteAsync(resourceGroupName, virtualMachineName, name).getSyncPoller(); + } + + /** + * Implements GuestAgent DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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, String name, Context context) { + return beginDeleteAsync(resourceGroupName, virtualMachineName, name, context).getSyncPoller(); + } + + /** + * Implements GuestAgent DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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, String name) { + return beginDeleteAsync(resourceGroupName, virtualMachineName, name) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Implements GuestAgent DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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, String name, Context context) { + return beginDeleteAsync(resourceGroupName, virtualMachineName, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Implements GuestAgent DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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, String name) { + deleteAsync(resourceGroupName, virtualMachineName, name).block(); + } + + /** + * Implements GuestAgent DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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, String name, Context context) { + deleteAsync(resourceGroupName, virtualMachineName, name, context).block(); + } + + /** + * Returns the list of GuestAgent of the given vm. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 GuestAgent along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVmSinglePageAsync( + 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 + .listByVm( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + 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 GuestAgent of the given vm. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 GuestAgent along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVmSinglePageAsync( + 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 + .listByVm( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + 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 GuestAgent of the given vm. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 GuestAgent as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByVmAsync(String resourceGroupName, String virtualMachineName) { + return new PagedFlux<>( + () -> listByVmSinglePageAsync(resourceGroupName, virtualMachineName), + nextLink -> listByVmNextSinglePageAsync(nextLink)); + } + + /** + * Returns the list of GuestAgent of the given vm. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 GuestAgent as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByVmAsync( + String resourceGroupName, String virtualMachineName, Context context) { + return new PagedFlux<>( + () -> listByVmSinglePageAsync(resourceGroupName, virtualMachineName, context), + nextLink -> listByVmNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns the list of GuestAgent of the given vm. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 GuestAgent as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByVm(String resourceGroupName, String virtualMachineName) { + return new PagedIterable<>(listByVmAsync(resourceGroupName, virtualMachineName)); + } + + /** + * Returns the list of GuestAgent of the given vm. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 GuestAgent as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByVm( + String resourceGroupName, String virtualMachineName, Context context) { + return new PagedIterable<>(listByVmAsync(resourceGroupName, virtualMachineName, 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 GuestAgent along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVmNextSinglePageAsync(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.listByVmNext(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 GuestAgent along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVmNextSinglePageAsync(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 + .listByVmNext(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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/GuestAgentsImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/GuestAgentsImpl.java new file mode 100644 index 000000000000..184d86baee28 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/GuestAgentsImpl.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.GuestAgentsClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.GuestAgentInner; +import com.azure.resourcemanager.connectedvmware.models.GuestAgent; +import com.azure.resourcemanager.connectedvmware.models.GuestAgents; + +public final class GuestAgentsImpl implements GuestAgents { + private static final ClientLogger LOGGER = new ClientLogger(GuestAgentsImpl.class); + + private final GuestAgentsClient innerClient; + + private final com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager; + + public GuestAgentsImpl( + GuestAgentsClient innerClient, + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public GuestAgent get(String resourceGroupName, String virtualMachineName, String name) { + GuestAgentInner inner = this.serviceClient().get(resourceGroupName, virtualMachineName, name); + if (inner != null) { + return new GuestAgentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String virtualMachineName, String name, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, virtualMachineName, name, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GuestAgentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String virtualMachineName, String name) { + this.serviceClient().delete(resourceGroupName, virtualMachineName, name); + } + + public void delete(String resourceGroupName, String virtualMachineName, String name, Context context) { + this.serviceClient().delete(resourceGroupName, virtualMachineName, name, context); + } + + public PagedIterable listByVm(String resourceGroupName, String virtualMachineName) { + PagedIterable inner = this.serviceClient().listByVm(resourceGroupName, virtualMachineName); + return Utils.mapPage(inner, inner1 -> new GuestAgentImpl(inner1, this.manager())); + } + + public PagedIterable listByVm(String resourceGroupName, String virtualMachineName, Context context) { + PagedIterable inner = + this.serviceClient().listByVm(resourceGroupName, virtualMachineName, context); + return Utils.mapPage(inner, inner1 -> new GuestAgentImpl(inner1, this.manager())); + } + + public GuestAgent 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))); + } + String name = Utils.getValueFromIdByName(id, "guestAgents"); + if (name == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'guestAgents'.", id))); + } + return this.getWithResponse(resourceGroupName, virtualMachineName, name, 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))); + } + String name = Utils.getValueFromIdByName(id, "guestAgents"); + if (name == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'guestAgents'.", id))); + } + return this.getWithResponse(resourceGroupName, virtualMachineName, name, 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))); + } + String name = Utils.getValueFromIdByName(id, "guestAgents"); + if (name == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'guestAgents'.", id))); + } + this.delete(resourceGroupName, virtualMachineName, name, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String 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))); + } + String name = Utils.getValueFromIdByName(id, "guestAgents"); + if (name == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'guestAgents'.", id))); + } + this.delete(resourceGroupName, virtualMachineName, name, context); + } + + private GuestAgentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } + + public GuestAgentImpl define(String name) { + return new GuestAgentImpl(name, this.manager()); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/HostModelImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/HostModelImpl.java new file mode 100644 index 000000000000..ac1c346c9b29 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/HostModelImpl.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.fluent.models.HostModelInner; +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; +import com.azure.resourcemanager.connectedvmware.models.HostModel; +import com.azure.resourcemanager.connectedvmware.models.ResourcePatch; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class HostModelImpl implements HostModel, HostModel.Definition, HostModel.Update { + private HostModelInner innerObject; + + private final com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String uuid() { + return this.innerModel().uuid(); + } + + public String vCenterId() { + return this.innerModel().vCenterId(); + } + + public String moRefId() { + return this.innerModel().moRefId(); + } + + public String inventoryItemId() { + return this.innerModel().inventoryItemId(); + } + + public String moName() { + return this.innerModel().moName(); + } + + public List statuses() { + List inner = this.innerModel().statuses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String customResourceName() { + return this.innerModel().customResourceName(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public HostModelInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String hostname; + + private ResourcePatch updateBody; + + public HostModelImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public HostModel create() { + this.innerObject = + serviceManager + .serviceClient() + .getHosts() + .create(resourceGroupName, hostname, this.innerModel(), Context.NONE); + return this; + } + + public HostModel create(Context context) { + this.innerObject = + serviceManager.serviceClient().getHosts().create(resourceGroupName, hostname, this.innerModel(), context); + return this; + } + + HostModelImpl(String name, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerObject = new HostModelInner(); + this.serviceManager = serviceManager; + this.hostname = name; + } + + public HostModelImpl update() { + this.updateBody = new ResourcePatch(); + return this; + } + + public HostModel apply() { + this.innerObject = + serviceManager + .serviceClient() + .getHosts() + .updateWithResponse(resourceGroupName, hostname, updateBody, Context.NONE) + .getValue(); + return this; + } + + public HostModel apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getHosts() + .updateWithResponse(resourceGroupName, hostname, updateBody, context) + .getValue(); + return this; + } + + HostModelImpl( + HostModelInner innerObject, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.hostname = Utils.getValueFromIdByName(innerObject.id(), "hosts"); + } + + public HostModel refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getHosts() + .getByResourceGroupWithResponse(resourceGroupName, hostname, Context.NONE) + .getValue(); + return this; + } + + public HostModel refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getHosts() + .getByResourceGroupWithResponse(resourceGroupName, hostname, context) + .getValue(); + return this; + } + + public HostModelImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public HostModelImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public HostModelImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public HostModelImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public HostModelImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } + + public HostModelImpl withVCenterId(String vCenterId) { + this.innerModel().withVCenterId(vCenterId); + return this; + } + + public HostModelImpl withMoRefId(String moRefId) { + this.innerModel().withMoRefId(moRefId); + return this; + } + + public HostModelImpl withInventoryItemId(String inventoryItemId) { + this.innerModel().withInventoryItemId(inventoryItemId); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/HostsClientImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/HostsClientImpl.java new file mode 100644 index 000000000000..5ae2c8524439 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/HostsClientImpl.java @@ -0,0 +1,1526 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.HostsClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.HostModelInner; +import com.azure.resourcemanager.connectedvmware.models.HostsList; +import com.azure.resourcemanager.connectedvmware.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 HostsClient. */ +public final class HostsClientImpl implements HostsClient { + /** The proxy service used to perform REST calls. */ + private final HostsService service; + + /** The service client containing this operation class. */ + private final ConnectedVMwareClientImpl client; + + /** + * Initializes an instance of HostsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + HostsClientImpl(ConnectedVMwareClientImpl client) { + this.service = RestProxy.create(HostsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConnectedVMwareClientHosts to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConnectedVMwareClien") + private interface HostsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/hosts/{hostName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostName") String hostname, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") HostModelInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/hosts/{hostName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostName") String hostname, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/hosts/{hostName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostName") String hostname, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResourcePatch body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/hosts/{hostName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostName") String hostname, + @QueryParam("api-version") String apiVersion, + @QueryParam("force") Boolean force, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/hosts") + @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( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/hosts") + @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("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create Or Update host. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @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 define the host along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String hostname, HostModelInner 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 (hostname == null) { + return Mono.error(new IllegalArgumentException("Parameter hostname 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, + hostname, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create Or Update host. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @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 define the host along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String hostname, HostModelInner 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 (hostname == null) { + return Mono.error(new IllegalArgumentException("Parameter hostname 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, + hostname, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Create Or Update host. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @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 define the host. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, HostModelInner> beginCreateAsync( + String resourceGroupName, String hostname, HostModelInner body) { + Mono>> mono = createWithResponseAsync(resourceGroupName, hostname, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + HostModelInner.class, + HostModelInner.class, + this.client.getContext()); + } + + /** + * Create Or Update host. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @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 define the host. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, HostModelInner> beginCreateAsync( + String resourceGroupName, String hostname, HostModelInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createWithResponseAsync(resourceGroupName, hostname, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), HostModelInner.class, HostModelInner.class, context); + } + + /** + * Create Or Update host. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @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 define the host. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, HostModelInner> beginCreate( + String resourceGroupName, String hostname, HostModelInner body) { + return beginCreateAsync(resourceGroupName, hostname, body).getSyncPoller(); + } + + /** + * Create Or Update host. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @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 define the host. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, HostModelInner> beginCreate( + String resourceGroupName, String hostname, HostModelInner body, Context context) { + return beginCreateAsync(resourceGroupName, hostname, body, context).getSyncPoller(); + } + + /** + * Create Or Update host. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @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 define the host on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String hostname, HostModelInner body) { + return beginCreateAsync(resourceGroupName, hostname, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update host. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the host on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String hostname) { + final HostModelInner body = null; + return beginCreateAsync(resourceGroupName, hostname, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update host. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @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 define the host on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String hostname, HostModelInner body, Context context) { + return beginCreateAsync(resourceGroupName, hostname, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update host. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @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 define the host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HostModelInner create(String resourceGroupName, String hostname, HostModelInner body) { + return createAsync(resourceGroupName, hostname, body).block(); + } + + /** + * Create Or Update host. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HostModelInner create(String resourceGroupName, String hostname) { + final HostModelInner body = null; + return createAsync(resourceGroupName, hostname, body).block(); + } + + /** + * Create Or Update host. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @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 define the host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HostModelInner create(String resourceGroupName, String hostname, HostModelInner body, Context context) { + return createAsync(resourceGroupName, hostname, body, context).block(); + } + + /** + * Implements host GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the host along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String hostname) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostname == null) { + return Mono.error(new IllegalArgumentException("Parameter hostname is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + hostname, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements host GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the host along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String hostname, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostname == null) { + return Mono.error(new IllegalArgumentException("Parameter hostname 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, + hostname, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Implements host GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the host on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String hostname) { + return getByResourceGroupWithResponseAsync(resourceGroupName, hostname) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Implements host GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HostModelInner getByResourceGroup(String resourceGroupName, String hostname) { + return getByResourceGroupAsync(resourceGroupName, hostname).block(); + } + + /** + * Implements host GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the host along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String hostname, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, hostname, context).block(); + } + + /** + * API to update certain properties of the host resource. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param body Resource properties to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the host along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String hostname, ResourcePatch 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 (hostname == null) { + return Mono.error(new IllegalArgumentException("Parameter hostname is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + hostname, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * API to update certain properties of the host resource. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the host along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String hostname, 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostname == null) { + return Mono.error(new IllegalArgumentException("Parameter hostname is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + hostname, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * API to update certain properties of the host resource. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param body Resource properties to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the host on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String hostname, ResourcePatch body) { + return updateWithResponseAsync(resourceGroupName, hostname, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * API to update certain properties of the host resource. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the host on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String hostname) { + final ResourcePatch body = null; + return updateWithResponseAsync(resourceGroupName, hostname, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * API to update certain properties of the host resource. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HostModelInner update(String resourceGroupName, String hostname) { + final ResourcePatch body = null; + return updateAsync(resourceGroupName, hostname, body).block(); + } + + /** + * API to update certain properties of the host resource. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the host along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String hostname, ResourcePatch body, Context context) { + return updateWithResponseAsync(resourceGroupName, hostname, body, context).block(); + } + + /** + * Implements host DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 hostname, 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 (hostname == null) { + return Mono.error(new IllegalArgumentException("Parameter hostname is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + hostname, + this.client.getApiVersion(), + force, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements host DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 hostname, 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 (hostname == null) { + return Mono.error(new IllegalArgumentException("Parameter hostname 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, + hostname, + this.client.getApiVersion(), + force, + accept, + context); + } + + /** + * Implements host DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 hostname, Boolean force) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, hostname, force); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Implements host DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 hostname, Boolean force, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, hostname, force, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Implements host DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 hostname, Boolean force) { + return beginDeleteAsync(resourceGroupName, hostname, force).getSyncPoller(); + } + + /** + * Implements host DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 hostname, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, hostname, force, context).getSyncPoller(); + } + + /** + * Implements host DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 hostname, Boolean force) { + return beginDeleteAsync(resourceGroupName, hostname, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Implements host DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 hostname) { + final Boolean force = null; + return beginDeleteAsync(resourceGroupName, hostname, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Implements host DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 hostname, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, hostname, force, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Implements host DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 hostname, Boolean force) { + deleteAsync(resourceGroupName, hostname, force).block(); + } + + /** + * Implements host DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 hostname) { + final Boolean force = null; + deleteAsync(resourceGroupName, hostname, force).block(); + } + + /** + * Implements host DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 hostname, Boolean force, Context context) { + deleteAsync(resourceGroupName, hostname, force, context).block(); + } + + /** + * List of hosts 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 Hosts 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 hosts 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 Hosts 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 hosts 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 Hosts as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List of hosts 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 Hosts as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List of hosts 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 Hosts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List of hosts 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 Hosts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List of hosts in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Hosts 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 hosts in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Hosts 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 hosts in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Hosts 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 hosts in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Hosts 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 hosts in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Hosts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List of hosts in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Hosts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Hosts 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 list of Hosts along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Hosts 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 Hosts along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/HostsImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/HostsImpl.java new file mode 100644 index 000000000000..d73825ddd5f1 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/HostsImpl.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.HostsClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.HostModelInner; +import com.azure.resourcemanager.connectedvmware.models.HostModel; +import com.azure.resourcemanager.connectedvmware.models.Hosts; + +public final class HostsImpl implements Hosts { + private static final ClientLogger LOGGER = new ClientLogger(HostsImpl.class); + + private final HostsClient innerClient; + + private final com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager; + + public HostsImpl( + HostsClient innerClient, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public HostModel getByResourceGroup(String resourceGroupName, String hostname) { + HostModelInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, hostname); + if (inner != null) { + return new HostModelImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String hostname, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, hostname, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new HostModelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String hostname, Boolean force) { + this.serviceClient().delete(resourceGroupName, hostname, force); + } + + public void delete(String resourceGroupName, String hostname) { + this.serviceClient().delete(resourceGroupName, hostname); + } + + public void delete(String resourceGroupName, String hostname, Boolean force, Context context) { + this.serviceClient().delete(resourceGroupName, hostname, force, context); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new HostModelImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new HostModelImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new HostModelImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new HostModelImpl(inner1, this.manager())); + } + + public HostModel 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 hostname = Utils.getValueFromIdByName(id, "hosts"); + if (hostname == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hosts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, hostname, 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 hostname = Utils.getValueFromIdByName(id, "hosts"); + if (hostname == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hosts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, hostname, 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 hostname = Utils.getValueFromIdByName(id, "hosts"); + if (hostname == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hosts'.", id))); + } + Boolean localForce = null; + this.delete(resourceGroupName, hostname, 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 hostname = Utils.getValueFromIdByName(id, "hosts"); + if (hostname == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hosts'.", id))); + } + this.delete(resourceGroupName, hostname, force, context); + } + + private HostsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } + + public HostModelImpl define(String name) { + return new HostModelImpl(name, this.manager()); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/HybridIdentityMetadataImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/HybridIdentityMetadataImpl.java new file mode 100644 index 000000000000..f9540b624499 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/HybridIdentityMetadataImpl.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.fluent.models.HybridIdentityMetadataInner; +import com.azure.resourcemanager.connectedvmware.models.HybridIdentityMetadata; +import com.azure.resourcemanager.connectedvmware.models.Identity; + +public final class HybridIdentityMetadataImpl implements HybridIdentityMetadata, HybridIdentityMetadata.Definition { + private HybridIdentityMetadataInner innerObject; + + private final com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager; + + HybridIdentityMetadataImpl( + HybridIdentityMetadataInner innerObject, + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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 vmId() { + return this.innerModel().vmId(); + } + + public String publicKey() { + return this.innerModel().publicKey(); + } + + public Identity identity() { + return this.innerModel().identity(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public HybridIdentityMetadataInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String virtualMachineName; + + private String metadataName; + + public HybridIdentityMetadataImpl withExistingVirtualMachine(String resourceGroupName, String virtualMachineName) { + this.resourceGroupName = resourceGroupName; + this.virtualMachineName = virtualMachineName; + return this; + } + + public HybridIdentityMetadata create() { + this.innerObject = + serviceManager + .serviceClient() + .getHybridIdentityMetadatas() + .createWithResponse( + resourceGroupName, virtualMachineName, metadataName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public HybridIdentityMetadata create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getHybridIdentityMetadatas() + .createWithResponse(resourceGroupName, virtualMachineName, metadataName, this.innerModel(), context) + .getValue(); + return this; + } + + HybridIdentityMetadataImpl( + String name, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerObject = new HybridIdentityMetadataInner(); + this.serviceManager = serviceManager; + this.metadataName = name; + } + + public HybridIdentityMetadata refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getHybridIdentityMetadatas() + .getWithResponse(resourceGroupName, virtualMachineName, metadataName, Context.NONE) + .getValue(); + return this; + } + + public HybridIdentityMetadata refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getHybridIdentityMetadatas() + .getWithResponse(resourceGroupName, virtualMachineName, metadataName, context) + .getValue(); + return this; + } + + public HybridIdentityMetadataImpl withVmId(String vmId) { + this.innerModel().withVmId(vmId); + return this; + } + + public HybridIdentityMetadataImpl withPublicKey(String publicKey) { + this.innerModel().withPublicKey(publicKey); + return this; + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/HybridIdentityMetadatasClientImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/HybridIdentityMetadatasClientImpl.java new file mode 100644 index 000000000000..f0ad227c8d03 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/HybridIdentityMetadatasClientImpl.java @@ -0,0 +1,928 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.HybridIdentityMetadatasClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.HybridIdentityMetadataInner; +import com.azure.resourcemanager.connectedvmware.models.HybridIdentityMetadataList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in HybridIdentityMetadatasClient. */ +public final class HybridIdentityMetadatasClientImpl implements HybridIdentityMetadatasClient { + /** The proxy service used to perform REST calls. */ + private final HybridIdentityMetadatasService service; + + /** The service client containing this operation class. */ + private final ConnectedVMwareClientImpl client; + + /** + * Initializes an instance of HybridIdentityMetadatasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + HybridIdentityMetadatasClientImpl(ConnectedVMwareClientImpl client) { + this.service = + RestProxy + .create(HybridIdentityMetadatasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConnectedVMwareClientHybridIdentityMetadatas to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConnectedVMwareClien") + private interface HybridIdentityMetadatasService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata" + + "/{metadataName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualMachineName") String virtualMachineName, + @PathParam("metadataName") String metadataName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") HybridIdentityMetadataInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata" + + "/{metadataName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualMachineName") String virtualMachineName, + @PathParam("metadataName") String metadataName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata" + + "/{metadataName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualMachineName") String virtualMachineName, + @PathParam("metadataName") String metadataName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByVm( + @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"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByVmNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create Or Update HybridIdentityMetadata. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the hybridIdentityMetadata. + * @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 HybridIdentityMetadata along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, String virtualMachineName, String metadataName, HybridIdentityMetadataInner 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 (metadataName == null) { + return Mono.error(new IllegalArgumentException("Parameter metadataName 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, + virtualMachineName, + metadataName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create Or Update HybridIdentityMetadata. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the hybridIdentityMetadata. + * @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 HybridIdentityMetadata along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String virtualMachineName, + String metadataName, + HybridIdentityMetadataInner 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 (metadataName == null) { + return Mono.error(new IllegalArgumentException("Parameter metadataName 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, + virtualMachineName, + metadataName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Create Or Update HybridIdentityMetadata. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the hybridIdentityMetadata. + * @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 HybridIdentityMetadata on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String virtualMachineName, String metadataName, HybridIdentityMetadataInner body) { + return createWithResponseAsync(resourceGroupName, virtualMachineName, metadataName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create Or Update HybridIdentityMetadata. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the hybridIdentityMetadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the HybridIdentityMetadata on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String virtualMachineName, String metadataName) { + final HybridIdentityMetadataInner body = null; + return createWithResponseAsync(resourceGroupName, virtualMachineName, metadataName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create Or Update HybridIdentityMetadata. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the hybridIdentityMetadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the HybridIdentityMetadata. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HybridIdentityMetadataInner create( + String resourceGroupName, String virtualMachineName, String metadataName) { + final HybridIdentityMetadataInner body = null; + return createAsync(resourceGroupName, virtualMachineName, metadataName, body).block(); + } + + /** + * Create Or Update HybridIdentityMetadata. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the hybridIdentityMetadata. + * @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 HybridIdentityMetadata along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String virtualMachineName, + String metadataName, + HybridIdentityMetadataInner body, + Context context) { + return createWithResponseAsync(resourceGroupName, virtualMachineName, metadataName, body, context).block(); + } + + /** + * Implements HybridIdentityMetadata GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the HybridIdentityMetadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the HybridIdentityMetadata along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String virtualMachineName, String metadataName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (metadataName == null) { + return Mono.error(new IllegalArgumentException("Parameter metadataName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + metadataName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements HybridIdentityMetadata GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the HybridIdentityMetadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the HybridIdentityMetadata along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String virtualMachineName, String metadataName, 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 (metadataName == null) { + return Mono.error(new IllegalArgumentException("Parameter metadataName 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, + virtualMachineName, + metadataName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Implements HybridIdentityMetadata GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the HybridIdentityMetadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the HybridIdentityMetadata on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String virtualMachineName, String metadataName) { + return getWithResponseAsync(resourceGroupName, virtualMachineName, metadataName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Implements HybridIdentityMetadata GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the HybridIdentityMetadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the HybridIdentityMetadata. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HybridIdentityMetadataInner get(String resourceGroupName, String virtualMachineName, String metadataName) { + return getAsync(resourceGroupName, virtualMachineName, metadataName).block(); + } + + /** + * Implements HybridIdentityMetadata GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the HybridIdentityMetadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the HybridIdentityMetadata along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String virtualMachineName, String metadataName, Context context) { + return getWithResponseAsync(resourceGroupName, virtualMachineName, metadataName, context).block(); + } + + /** + * Implements HybridIdentityMetadata DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the HybridIdentityMetadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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, String metadataName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 (metadataName == null) { + return Mono.error(new IllegalArgumentException("Parameter metadataName 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, + metadataName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements HybridIdentityMetadata DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the HybridIdentityMetadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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, String metadataName, 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 (metadataName == null) { + return Mono.error(new IllegalArgumentException("Parameter metadataName 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, + metadataName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Implements HybridIdentityMetadata DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the HybridIdentityMetadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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, String metadataName) { + return deleteWithResponseAsync(resourceGroupName, virtualMachineName, metadataName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Implements HybridIdentityMetadata DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the HybridIdentityMetadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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, String metadataName) { + deleteAsync(resourceGroupName, virtualMachineName, metadataName).block(); + } + + /** + * Implements HybridIdentityMetadata DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the HybridIdentityMetadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 virtualMachineName, String metadataName, Context context) { + return deleteWithResponseAsync(resourceGroupName, virtualMachineName, metadataName, context).block(); + } + + /** + * Returns the list of HybridIdentityMetadata of the given vm. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 HybridIdentityMetadata along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVmSinglePageAsync( + 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 + .listByVm( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + 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 HybridIdentityMetadata of the given vm. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 HybridIdentityMetadata along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVmSinglePageAsync( + 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 + .listByVm( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + 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 HybridIdentityMetadata of the given vm. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 HybridIdentityMetadata as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByVmAsync(String resourceGroupName, String virtualMachineName) { + return new PagedFlux<>( + () -> listByVmSinglePageAsync(resourceGroupName, virtualMachineName), + nextLink -> listByVmNextSinglePageAsync(nextLink)); + } + + /** + * Returns the list of HybridIdentityMetadata of the given vm. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 HybridIdentityMetadata as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByVmAsync( + String resourceGroupName, String virtualMachineName, Context context) { + return new PagedFlux<>( + () -> listByVmSinglePageAsync(resourceGroupName, virtualMachineName, context), + nextLink -> listByVmNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns the list of HybridIdentityMetadata of the given vm. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 HybridIdentityMetadata as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByVm(String resourceGroupName, String virtualMachineName) { + return new PagedIterable<>(listByVmAsync(resourceGroupName, virtualMachineName)); + } + + /** + * Returns the list of HybridIdentityMetadata of the given vm. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 HybridIdentityMetadata as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByVm( + String resourceGroupName, String virtualMachineName, Context context) { + return new PagedIterable<>(listByVmAsync(resourceGroupName, virtualMachineName, 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 HybridIdentityMetadata along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVmNextSinglePageAsync(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.listByVmNext(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 HybridIdentityMetadata along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVmNextSinglePageAsync( + 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 + .listByVmNext(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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/HybridIdentityMetadatasImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/HybridIdentityMetadatasImpl.java new file mode 100644 index 000000000000..f8ac50d26d98 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/HybridIdentityMetadatasImpl.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.HybridIdentityMetadatasClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.HybridIdentityMetadataInner; +import com.azure.resourcemanager.connectedvmware.models.HybridIdentityMetadata; +import com.azure.resourcemanager.connectedvmware.models.HybridIdentityMetadatas; + +public final class HybridIdentityMetadatasImpl implements HybridIdentityMetadatas { + private static final ClientLogger LOGGER = new ClientLogger(HybridIdentityMetadatasImpl.class); + + private final HybridIdentityMetadatasClient innerClient; + + private final com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager; + + public HybridIdentityMetadatasImpl( + HybridIdentityMetadatasClient innerClient, + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public HybridIdentityMetadata get(String resourceGroupName, String virtualMachineName, String metadataName) { + HybridIdentityMetadataInner inner = + this.serviceClient().get(resourceGroupName, virtualMachineName, metadataName); + if (inner != null) { + return new HybridIdentityMetadataImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String virtualMachineName, String metadataName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, virtualMachineName, metadataName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new HybridIdentityMetadataImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String virtualMachineName, String metadataName) { + this.serviceClient().delete(resourceGroupName, virtualMachineName, metadataName); + } + + public Response deleteWithResponse( + String resourceGroupName, String virtualMachineName, String metadataName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, virtualMachineName, metadataName, context); + } + + public PagedIterable listByVm(String resourceGroupName, String virtualMachineName) { + PagedIterable inner = + this.serviceClient().listByVm(resourceGroupName, virtualMachineName); + return Utils.mapPage(inner, inner1 -> new HybridIdentityMetadataImpl(inner1, this.manager())); + } + + public PagedIterable listByVm( + String resourceGroupName, String virtualMachineName, Context context) { + PagedIterable inner = + this.serviceClient().listByVm(resourceGroupName, virtualMachineName, context); + return Utils.mapPage(inner, inner1 -> new HybridIdentityMetadataImpl(inner1, this.manager())); + } + + public HybridIdentityMetadata 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))); + } + String metadataName = Utils.getValueFromIdByName(id, "hybridIdentityMetadata"); + if (metadataName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'hybridIdentityMetadata'.", + id))); + } + return this.getWithResponse(resourceGroupName, virtualMachineName, metadataName, 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))); + } + String metadataName = Utils.getValueFromIdByName(id, "hybridIdentityMetadata"); + if (metadataName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'hybridIdentityMetadata'.", + id))); + } + return this.getWithResponse(resourceGroupName, virtualMachineName, metadataName, 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))); + } + String metadataName = Utils.getValueFromIdByName(id, "hybridIdentityMetadata"); + if (metadataName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'hybridIdentityMetadata'.", + id))); + } + this.deleteWithResponse(resourceGroupName, virtualMachineName, metadataName, 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 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))); + } + String metadataName = Utils.getValueFromIdByName(id, "hybridIdentityMetadata"); + if (metadataName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'hybridIdentityMetadata'.", + id))); + } + return this.deleteWithResponse(resourceGroupName, virtualMachineName, metadataName, context); + } + + private HybridIdentityMetadatasClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } + + public HybridIdentityMetadataImpl define(String name) { + return new HybridIdentityMetadataImpl(name, this.manager()); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/InventoryItemImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/InventoryItemImpl.java new file mode 100644 index 000000000000..3fec82cbb353 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/InventoryItemImpl.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.connectedvmware.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.fluent.models.InventoryItemInner; +import com.azure.resourcemanager.connectedvmware.models.InventoryItem; + +public final class InventoryItemImpl implements InventoryItem, InventoryItem.Definition { + private InventoryItemInner innerObject; + + private final com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager; + + InventoryItemImpl( + InventoryItemInner innerObject, + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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 moRefId() { + return this.innerModel().moRefId(); + } + + public String moName() { + return this.innerModel().moName(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public InventoryItemInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String vcenterName; + + private String inventoryItemName; + + public InventoryItemImpl withExistingVcenter(String resourceGroupName, String vcenterName) { + this.resourceGroupName = resourceGroupName; + this.vcenterName = vcenterName; + return this; + } + + public InventoryItem create() { + this.innerObject = + serviceManager + .serviceClient() + .getInventoryItems() + .createWithResponse(resourceGroupName, vcenterName, inventoryItemName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public InventoryItem create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getInventoryItems() + .createWithResponse(resourceGroupName, vcenterName, inventoryItemName, this.innerModel(), context) + .getValue(); + return this; + } + + InventoryItemImpl(String name, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerObject = new InventoryItemInner(); + this.serviceManager = serviceManager; + this.inventoryItemName = name; + } + + public InventoryItem refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getInventoryItems() + .getWithResponse(resourceGroupName, vcenterName, inventoryItemName, Context.NONE) + .getValue(); + return this; + } + + public InventoryItem refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getInventoryItems() + .getWithResponse(resourceGroupName, vcenterName, inventoryItemName, context) + .getValue(); + return this; + } + + public InventoryItemImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } + + public InventoryItemImpl withManagedResourceId(String managedResourceId) { + this.innerModel().withManagedResourceId(managedResourceId); + return this; + } + + public InventoryItemImpl withMoRefId(String moRefId) { + this.innerModel().withMoRefId(moRefId); + return this; + } + + public InventoryItemImpl withMoName(String moName) { + this.innerModel().withMoName(moName); + return this; + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/InventoryItemsClientImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/InventoryItemsClientImpl.java new file mode 100644 index 000000000000..8894e4ee8379 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/InventoryItemsClientImpl.java @@ -0,0 +1,919 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.InventoryItemsClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.InventoryItemInner; +import com.azure.resourcemanager.connectedvmware.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 ConnectedVMwareClientImpl client; + + /** + * Initializes an instance of InventoryItemsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + InventoryItemsClientImpl(ConnectedVMwareClientImpl client) { + this.service = + RestProxy.create(InventoryItemsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConnectedVMwareClientInventoryItems to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConnectedVMwareClien") + private interface InventoryItemsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/vcenters/{vcenterName}/inventoryItems/{inventoryItemName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vcenterName") String vcenterName, + @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.ConnectedVMwarevSphere/vcenters/{vcenterName}/inventoryItems/{inventoryItemName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vcenterName") String vcenterName, + @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.ConnectedVMwarevSphere/vcenters/{vcenterName}/inventoryItems/{inventoryItemName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vcenterName") String vcenterName, + @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.ConnectedVMwarevSphere/vcenters/{vcenterName}/inventoryItems") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByVCenter( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vcenterName") String vcenterName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByVCenterNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create Or Update InventoryItem. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, 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 (vcenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter vcenterName 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, + vcenterName, + inventoryItemName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create Or Update InventoryItem. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, + 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 (vcenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter vcenterName 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, + vcenterName, + inventoryItemName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Create Or Update InventoryItem. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, String inventoryItemName, InventoryItemInner body) { + return createWithResponseAsync(resourceGroupName, vcenterName, 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 Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, String inventoryItemName) { + final InventoryItemInner body = null; + return createWithResponseAsync(resourceGroupName, vcenterName, 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 Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, String inventoryItemName) { + final InventoryItemInner body = null; + return createAsync(resourceGroupName, vcenterName, inventoryItemName, body).block(); + } + + /** + * Create Or Update InventoryItem. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, + String inventoryItemName, + InventoryItemInner body, + Context context) { + return createWithResponseAsync(resourceGroupName, vcenterName, inventoryItemName, body, context).block(); + } + + /** + * Implements InventoryItem GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, 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 (vcenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter vcenterName 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, + vcenterName, + inventoryItemName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements InventoryItem GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, 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 (vcenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter vcenterName 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, + vcenterName, + inventoryItemName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Implements InventoryItem GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, String inventoryItemName) { + return getWithResponseAsync(resourceGroupName, vcenterName, inventoryItemName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Implements InventoryItem GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, String inventoryItemName) { + return getAsync(resourceGroupName, vcenterName, inventoryItemName).block(); + } + + /** + * Implements InventoryItem GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, String inventoryItemName, Context context) { + return getWithResponseAsync(resourceGroupName, vcenterName, inventoryItemName, context).block(); + } + + /** + * Implements inventoryItem DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, 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 (vcenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter vcenterName 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, + vcenterName, + inventoryItemName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements inventoryItem DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, 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 (vcenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter vcenterName 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, + vcenterName, + inventoryItemName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Implements inventoryItem DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, String inventoryItemName) { + return deleteWithResponseAsync(resourceGroupName, vcenterName, inventoryItemName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Implements inventoryItem DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, String inventoryItemName) { + deleteAsync(resourceGroupName, vcenterName, inventoryItemName).block(); + } + + /** + * Implements inventoryItem DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, String inventoryItemName, Context context) { + return deleteWithResponseAsync(resourceGroupName, vcenterName, inventoryItemName, context).block(); + } + + /** + * Returns the list of inventoryItems of the given vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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> listByVCenterSinglePageAsync( + String resourceGroupName, String vcenterName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vcenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter vcenterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByVCenter( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vcenterName, + 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 of the given vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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> listByVCenterSinglePageAsync( + String resourceGroupName, String vcenterName, 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 (vcenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter vcenterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByVCenter( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vcenterName, + 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 of the given vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 listByVCenterAsync(String resourceGroupName, String vcenterName) { + return new PagedFlux<>( + () -> listByVCenterSinglePageAsync(resourceGroupName, vcenterName), + nextLink -> listByVCenterNextSinglePageAsync(nextLink)); + } + + /** + * Returns the list of inventoryItems of the given vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 listByVCenterAsync( + String resourceGroupName, String vcenterName, Context context) { + return new PagedFlux<>( + () -> listByVCenterSinglePageAsync(resourceGroupName, vcenterName, context), + nextLink -> listByVCenterNextSinglePageAsync(nextLink, context)); + } + + /** + * Returns the list of inventoryItems of the given vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 listByVCenter(String resourceGroupName, String vcenterName) { + return new PagedIterable<>(listByVCenterAsync(resourceGroupName, vcenterName)); + } + + /** + * Returns the list of inventoryItems of the given vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 listByVCenter( + String resourceGroupName, String vcenterName, Context context) { + return new PagedIterable<>(listByVCenterAsync(resourceGroupName, vcenterName, 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> listByVCenterNextSinglePageAsync(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.listByVCenterNext(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> listByVCenterNextSinglePageAsync(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 + .listByVCenterNext(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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/InventoryItemsImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/InventoryItemsImpl.java new file mode 100644 index 000000000000..b25bd7d6fea4 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/InventoryItemsImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.InventoryItemsClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.InventoryItemInner; +import com.azure.resourcemanager.connectedvmware.models.InventoryItem; +import com.azure.resourcemanager.connectedvmware.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.connectedvmware.ConnectedVMwareManager serviceManager; + + public InventoryItemsImpl( + InventoryItemsClient innerClient, + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public InventoryItem get(String resourceGroupName, String vcenterName, String inventoryItemName) { + InventoryItemInner inner = this.serviceClient().get(resourceGroupName, vcenterName, inventoryItemName); + if (inner != null) { + return new InventoryItemImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String vcenterName, String inventoryItemName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, vcenterName, 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 vcenterName, String inventoryItemName) { + this.serviceClient().delete(resourceGroupName, vcenterName, inventoryItemName); + } + + public Response deleteWithResponse( + String resourceGroupName, String vcenterName, String inventoryItemName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, vcenterName, inventoryItemName, context); + } + + public PagedIterable listByVCenter(String resourceGroupName, String vcenterName) { + PagedIterable inner = this.serviceClient().listByVCenter(resourceGroupName, vcenterName); + return Utils.mapPage(inner, inner1 -> new InventoryItemImpl(inner1, this.manager())); + } + + public PagedIterable listByVCenter(String resourceGroupName, String vcenterName, Context context) { + PagedIterable inner = + this.serviceClient().listByVCenter(resourceGroupName, vcenterName, 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 vcenterName = Utils.getValueFromIdByName(id, "vcenters"); + if (vcenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vcenters'.", 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, vcenterName, 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 vcenterName = Utils.getValueFromIdByName(id, "vcenters"); + if (vcenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vcenters'.", 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, vcenterName, 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 vcenterName = Utils.getValueFromIdByName(id, "vcenters"); + if (vcenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vcenters'.", 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, vcenterName, 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 vcenterName = Utils.getValueFromIdByName(id, "vcenters"); + if (vcenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vcenters'.", 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, vcenterName, inventoryItemName, context); + } + + private InventoryItemsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } + + public InventoryItemImpl define(String name) { + return new InventoryItemImpl(name, this.manager()); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/MachineExtensionImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/MachineExtensionImpl.java new file mode 100644 index 000000000000..f7ea6b7fd2a1 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/MachineExtensionImpl.java @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.fluent.models.MachineExtensionInner; +import com.azure.resourcemanager.connectedvmware.models.MachineExtension; +import com.azure.resourcemanager.connectedvmware.models.MachineExtensionPropertiesInstanceView; +import com.azure.resourcemanager.connectedvmware.models.MachineExtensionUpdate; +import java.util.Collections; +import java.util.Map; + +public final class MachineExtensionImpl + implements MachineExtension, MachineExtension.Definition, MachineExtension.Update { + private MachineExtensionInner innerObject; + + private final com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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 String forceUpdateTag() { + return this.innerModel().forceUpdateTag(); + } + + public String publisher() { + return this.innerModel().publisher(); + } + + public String typePropertiesType() { + return this.innerModel().typePropertiesType(); + } + + public String typeHandlerVersion() { + return this.innerModel().typeHandlerVersion(); + } + + public Boolean autoUpgradeMinorVersion() { + return this.innerModel().autoUpgradeMinorVersion(); + } + + public Object settings() { + return this.innerModel().settings(); + } + + public Object protectedSettings() { + return this.innerModel().protectedSettings(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public MachineExtensionPropertiesInstanceView instanceView() { + return this.innerModel().instanceView(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public MachineExtensionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String name; + + private String extensionName; + + private MachineExtensionUpdate updateExtensionParameters; + + public MachineExtensionImpl withExistingVirtualMachine(String resourceGroupName, String name) { + this.resourceGroupName = resourceGroupName; + this.name = name; + return this; + } + + public MachineExtension create() { + this.innerObject = + serviceManager + .serviceClient() + .getMachineExtensions() + .createOrUpdate(resourceGroupName, name, extensionName, this.innerModel(), Context.NONE); + return this; + } + + public MachineExtension create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMachineExtensions() + .createOrUpdate(resourceGroupName, name, extensionName, this.innerModel(), context); + return this; + } + + MachineExtensionImpl(String name, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerObject = new MachineExtensionInner(); + this.serviceManager = serviceManager; + this.extensionName = name; + } + + public MachineExtensionImpl update() { + this.updateExtensionParameters = new MachineExtensionUpdate(); + return this; + } + + public MachineExtension apply() { + this.innerObject = + serviceManager + .serviceClient() + .getMachineExtensions() + .update(resourceGroupName, name, extensionName, updateExtensionParameters, Context.NONE); + return this; + } + + public MachineExtension apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMachineExtensions() + .update(resourceGroupName, name, extensionName, updateExtensionParameters, context); + return this; + } + + MachineExtensionImpl( + MachineExtensionInner innerObject, + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.name = Utils.getValueFromIdByName(innerObject.id(), "virtualMachines"); + this.extensionName = Utils.getValueFromIdByName(innerObject.id(), "extensions"); + } + + public MachineExtension refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getMachineExtensions() + .getWithResponse(resourceGroupName, name, extensionName, Context.NONE) + .getValue(); + return this; + } + + public MachineExtension refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMachineExtensions() + .getWithResponse(resourceGroupName, name, extensionName, context) + .getValue(); + return this; + } + + public MachineExtensionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public MachineExtensionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public MachineExtensionImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateExtensionParameters.withTags(tags); + return this; + } + } + + public MachineExtensionImpl withForceUpdateTag(String forceUpdateTag) { + if (isInCreateMode()) { + this.innerModel().withForceUpdateTag(forceUpdateTag); + return this; + } else { + this.updateExtensionParameters.withForceUpdateTag(forceUpdateTag); + return this; + } + } + + public MachineExtensionImpl withPublisher(String publisher) { + if (isInCreateMode()) { + this.innerModel().withPublisher(publisher); + return this; + } else { + this.updateExtensionParameters.withPublisher(publisher); + return this; + } + } + + public MachineExtensionImpl withTypePropertiesType(String typePropertiesType) { + this.innerModel().withTypePropertiesType(typePropertiesType); + return this; + } + + public MachineExtensionImpl withTypeHandlerVersion(String typeHandlerVersion) { + if (isInCreateMode()) { + this.innerModel().withTypeHandlerVersion(typeHandlerVersion); + return this; + } else { + this.updateExtensionParameters.withTypeHandlerVersion(typeHandlerVersion); + return this; + } + } + + public MachineExtensionImpl withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + if (isInCreateMode()) { + this.innerModel().withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } else { + this.updateExtensionParameters.withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } + } + + public MachineExtensionImpl withSettings(Object settings) { + if (isInCreateMode()) { + this.innerModel().withSettings(settings); + return this; + } else { + this.updateExtensionParameters.withSettings(settings); + return this; + } + } + + public MachineExtensionImpl withProtectedSettings(Object protectedSettings) { + if (isInCreateMode()) { + this.innerModel().withProtectedSettings(protectedSettings); + return this; + } else { + this.updateExtensionParameters.withProtectedSettings(protectedSettings); + return this; + } + } + + public MachineExtensionImpl withInstanceView(MachineExtensionPropertiesInstanceView instanceView) { + this.innerModel().withInstanceView(instanceView); + return this; + } + + public MachineExtensionImpl withType(String type) { + this.updateExtensionParameters.withType(type); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/MachineExtensionsClientImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/MachineExtensionsClientImpl.java new file mode 100644 index 000000000000..e0dfe26a29ec --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/MachineExtensionsClientImpl.java @@ -0,0 +1,1467 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.MachineExtensionsClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.MachineExtensionInner; +import com.azure.resourcemanager.connectedvmware.models.MachineExtensionUpdate; +import com.azure.resourcemanager.connectedvmware.models.MachineExtensionsListResult; +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 MachineExtensionsClient. */ +public final class MachineExtensionsClientImpl implements MachineExtensionsClient { + /** The proxy service used to perform REST calls. */ + private final MachineExtensionsService service; + + /** The service client containing this operation class. */ + private final ConnectedVMwareClientImpl client; + + /** + * Initializes an instance of MachineExtensionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MachineExtensionsClientImpl(ConnectedVMwareClientImpl client) { + this.service = + RestProxy.create(MachineExtensionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConnectedVMwareClientMachineExtensions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConnectedVMwareClien") + private interface MachineExtensionsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualMachines/{name}/extensions/{extensionName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("name") String name, + @PathParam("extensionName") String extensionName, + @BodyParam("application/json") MachineExtensionInner extensionParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualMachines/{name}/extensions/{extensionName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("name") String name, + @PathParam("extensionName") String extensionName, + @BodyParam("application/json") MachineExtensionUpdate extensionParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualMachines/{name}/extensions/{extensionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("name") String name, + @PathParam("extensionName") String extensionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualMachines/{name}/extensions/{extensionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("name") String name, + @PathParam("extensionName") String extensionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualMachines/{name}/extensions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @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); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String name, String extensionName, MachineExtensionInner extensionParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + if (extensionParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null.")); + } else { + extensionParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + name, + extensionName, + extensionParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionInner extensionParameters, + 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + if (extensionParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null.")); + } else { + extensionParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + name, + extensionName, + extensionParameters, + accept, + context); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MachineExtensionInner> beginCreateOrUpdateAsync( + String resourceGroupName, String name, String extensionName, MachineExtensionInner extensionParameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, name, extensionName, extensionParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + MachineExtensionInner.class, + MachineExtensionInner.class, + this.client.getContext()); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MachineExtensionInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionInner extensionParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, name, extensionName, extensionParameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), MachineExtensionInner.class, MachineExtensionInner.class, context); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MachineExtensionInner> beginCreateOrUpdate( + String resourceGroupName, String name, String extensionName, MachineExtensionInner extensionParameters) { + return beginCreateOrUpdateAsync(resourceGroupName, name, extensionName, extensionParameters).getSyncPoller(); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MachineExtensionInner> beginCreateOrUpdate( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionInner extensionParameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, name, extensionName, extensionParameters, context) + .getSyncPoller(); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String name, String extensionName, MachineExtensionInner extensionParameters) { + return beginCreateOrUpdateAsync(resourceGroupName, name, extensionName, extensionParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionInner extensionParameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, name, extensionName, extensionParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MachineExtensionInner createOrUpdate( + String resourceGroupName, String name, String extensionName, MachineExtensionInner extensionParameters) { + return createOrUpdateAsync(resourceGroupName, name, extensionName, extensionParameters).block(); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MachineExtensionInner createOrUpdate( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionInner extensionParameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, name, extensionName, extensionParameters, context).block(); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String name, String extensionName, MachineExtensionUpdate extensionParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + if (extensionParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null.")); + } else { + extensionParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + name, + extensionName, + extensionParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionUpdate extensionParameters, + 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + if (extensionParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null.")); + } else { + extensionParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + name, + extensionName, + extensionParameters, + accept, + context); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MachineExtensionInner> beginUpdateAsync( + String resourceGroupName, String name, String extensionName, MachineExtensionUpdate extensionParameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, name, extensionName, extensionParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + MachineExtensionInner.class, + MachineExtensionInner.class, + this.client.getContext()); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MachineExtensionInner> beginUpdateAsync( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionUpdate extensionParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, name, extensionName, extensionParameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), MachineExtensionInner.class, MachineExtensionInner.class, context); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MachineExtensionInner> beginUpdate( + String resourceGroupName, String name, String extensionName, MachineExtensionUpdate extensionParameters) { + return beginUpdateAsync(resourceGroupName, name, extensionName, extensionParameters).getSyncPoller(); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MachineExtensionInner> beginUpdate( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionUpdate extensionParameters, + Context context) { + return beginUpdateAsync(resourceGroupName, name, extensionName, extensionParameters, context).getSyncPoller(); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String name, String extensionName, MachineExtensionUpdate extensionParameters) { + return beginUpdateAsync(resourceGroupName, name, extensionName, extensionParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionUpdate extensionParameters, + Context context) { + return beginUpdateAsync(resourceGroupName, name, extensionName, extensionParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MachineExtensionInner update( + String resourceGroupName, String name, String extensionName, MachineExtensionUpdate extensionParameters) { + return updateAsync(resourceGroupName, name, extensionName, extensionParameters).block(); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Parameters supplied to the Create Machine Extension operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MachineExtensionInner update( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionUpdate extensionParameters, + Context context) { + return updateAsync(resourceGroupName, name, extensionName, extensionParameters, context).block(); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 name, String extensionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + name, + extensionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 name, String extensionName, 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName 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, + this.client.getApiVersion(), + name, + extensionName, + accept, + context); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 name, String extensionName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, name, extensionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 name, String extensionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, name, extensionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 name, String extensionName) { + return beginDeleteAsync(resourceGroupName, name, extensionName).getSyncPoller(); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 name, String extensionName, Context context) { + return beginDeleteAsync(resourceGroupName, name, extensionName, context).getSyncPoller(); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 name, String extensionName) { + return beginDeleteAsync(resourceGroupName, name, extensionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 name, String extensionName, Context context) { + return beginDeleteAsync(resourceGroupName, name, extensionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 name, String extensionName) { + deleteAsync(resourceGroupName, name, extensionName).block(); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 name, String extensionName, Context context) { + deleteAsync(resourceGroupName, name, extensionName, context).block(); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine containing the extension. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String name, String extensionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + name, + extensionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine containing the extension. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String name, String extensionName, 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName 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, + this.client.getApiVersion(), + name, + extensionName, + accept, + context); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine containing the extension. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String name, String extensionName) { + return getWithResponseAsync(resourceGroupName, name, extensionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine containing the extension. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MachineExtensionInner get(String resourceGroupName, String name, String extensionName) { + return getAsync(resourceGroupName, name, extensionName).block(); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine containing the extension. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String name, String extensionName, Context context) { + return getWithResponseAsync(resourceGroupName, name, extensionName, context).block(); + } + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the Machine Extensions List Result along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String name, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + name, + expand, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the Machine Extensions List Result along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String name, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name 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(), + resourceGroupName, + this.client.getApiVersion(), + name, + expand, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the Machine Extensions List Result as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String name, String expand) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, name, expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine containing the extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the Machine Extensions List Result as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String name) { + final String expand = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, name, expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the Machine Extensions List Result as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String name, String expand, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, name, expand, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine containing the extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the Machine Extensions List Result as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String name) { + final String expand = null; + return new PagedIterable<>(listAsync(resourceGroupName, name, expand)); + } + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the Machine Extensions List Result as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String name, String expand, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, name, expand, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the Machine Extensions List Result 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 describes the Machine Extensions List Result 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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/MachineExtensionsImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/MachineExtensionsImpl.java new file mode 100644 index 000000000000..20c27aa1787f --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/MachineExtensionsImpl.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.MachineExtensionsClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.MachineExtensionInner; +import com.azure.resourcemanager.connectedvmware.models.MachineExtension; +import com.azure.resourcemanager.connectedvmware.models.MachineExtensions; + +public final class MachineExtensionsImpl implements MachineExtensions { + private static final ClientLogger LOGGER = new ClientLogger(MachineExtensionsImpl.class); + + private final MachineExtensionsClient innerClient; + + private final com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager; + + public MachineExtensionsImpl( + MachineExtensionsClient innerClient, + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String name, String extensionName) { + this.serviceClient().delete(resourceGroupName, name, extensionName); + } + + public void delete(String resourceGroupName, String name, String extensionName, Context context) { + this.serviceClient().delete(resourceGroupName, name, extensionName, context); + } + + public MachineExtension get(String resourceGroupName, String name, String extensionName) { + MachineExtensionInner inner = this.serviceClient().get(resourceGroupName, name, extensionName); + if (inner != null) { + return new MachineExtensionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String name, String extensionName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, name, extensionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MachineExtensionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, String name) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, name); + return Utils.mapPage(inner, inner1 -> new MachineExtensionImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String name, String expand, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, name, expand, context); + return Utils.mapPage(inner, inner1 -> new MachineExtensionImpl(inner1, this.manager())); + } + + public MachineExtension 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 name = Utils.getValueFromIdByName(id, "virtualMachines"); + if (name == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + String extensionName = Utils.getValueFromIdByName(id, "extensions"); + if (extensionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensions'.", id))); + } + return this.getWithResponse(resourceGroupName, name, extensionName, 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 name = Utils.getValueFromIdByName(id, "virtualMachines"); + if (name == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + String extensionName = Utils.getValueFromIdByName(id, "extensions"); + if (extensionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensions'.", id))); + } + return this.getWithResponse(resourceGroupName, name, extensionName, 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 name = Utils.getValueFromIdByName(id, "virtualMachines"); + if (name == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + String extensionName = Utils.getValueFromIdByName(id, "extensions"); + if (extensionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensions'.", id))); + } + this.delete(resourceGroupName, name, extensionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String name = Utils.getValueFromIdByName(id, "virtualMachines"); + if (name == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + String extensionName = Utils.getValueFromIdByName(id, "extensions"); + if (extensionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensions'.", id))); + } + this.delete(resourceGroupName, name, extensionName, context); + } + + private MachineExtensionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } + + public MachineExtensionImpl define(String name) { + return new MachineExtensionImpl(name, this.manager()); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/OperationImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/OperationImpl.java new file mode 100644 index 000000000000..e17e393af472 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/OperationImpl.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.connectedvmware.implementation; + +import com.azure.resourcemanager.connectedvmware.fluent.models.OperationInner; +import com.azure.resourcemanager.connectedvmware.models.Operation; +import com.azure.resourcemanager.connectedvmware.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager; + + OperationImpl( + OperationInner innerObject, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/OperationsClientImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..02d7603bb67c --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/OperationsClientImpl.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.OperationsClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.OperationInner; +import com.azure.resourcemanager.connectedvmware.models.OperationsList; +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 ConnectedVMwareClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ConnectedVMwareClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConnectedVMwareClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConnectedVMwareClien") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ConnectedVMwarevSphere/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 lists the operations available 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 lists the operations available 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 lists the operations available 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 lists the operations available 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 lists the operations available 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 lists the operations available 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 lists the operations available 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 lists the operations available 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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/OperationsImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/OperationsImpl.java new file mode 100644 index 000000000000..961049c15e65 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.OperationsClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.OperationInner; +import com.azure.resourcemanager.connectedvmware.models.Operation; +import com.azure.resourcemanager.connectedvmware.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ResourcePoolImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ResourcePoolImpl.java new file mode 100644 index 000000000000..f567996ce9ea --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ResourcePoolImpl.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.fluent.models.ResourcePoolInner; +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; +import com.azure.resourcemanager.connectedvmware.models.ResourcePatch; +import com.azure.resourcemanager.connectedvmware.models.ResourcePool; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ResourcePoolImpl implements ResourcePool, ResourcePool.Definition, ResourcePool.Update { + private ResourcePoolInner innerObject; + + private final com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String uuid() { + return this.innerModel().uuid(); + } + + public String vCenterId() { + return this.innerModel().vCenterId(); + } + + public String moRefId() { + return this.innerModel().moRefId(); + } + + public String inventoryItemId() { + return this.innerModel().inventoryItemId(); + } + + public String moName() { + return this.innerModel().moName(); + } + + public String cpuSharesLevel() { + return this.innerModel().cpuSharesLevel(); + } + + public Long cpuReservationMHz() { + return this.innerModel().cpuReservationMHz(); + } + + public Long cpuLimitMHz() { + return this.innerModel().cpuLimitMHz(); + } + + public String memSharesLevel() { + return this.innerModel().memSharesLevel(); + } + + public Long memReservationMB() { + return this.innerModel().memReservationMB(); + } + + public Long memLimitMB() { + return this.innerModel().memLimitMB(); + } + + public String customResourceName() { + return this.innerModel().customResourceName(); + } + + public List statuses() { + List inner = this.innerModel().statuses(); + 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 ResourcePoolInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String resourcePoolName; + + private ResourcePatch updateBody; + + public ResourcePoolImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ResourcePool create() { + this.innerObject = + serviceManager + .serviceClient() + .getResourcePools() + .create(resourceGroupName, resourcePoolName, this.innerModel(), Context.NONE); + return this; + } + + public ResourcePool create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getResourcePools() + .create(resourceGroupName, resourcePoolName, this.innerModel(), context); + return this; + } + + ResourcePoolImpl(String name, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerObject = new ResourcePoolInner(); + this.serviceManager = serviceManager; + this.resourcePoolName = name; + } + + public ResourcePoolImpl update() { + this.updateBody = new ResourcePatch(); + return this; + } + + public ResourcePool apply() { + this.innerObject = + serviceManager + .serviceClient() + .getResourcePools() + .updateWithResponse(resourceGroupName, resourcePoolName, updateBody, Context.NONE) + .getValue(); + return this; + } + + public ResourcePool apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getResourcePools() + .updateWithResponse(resourceGroupName, resourcePoolName, updateBody, context) + .getValue(); + return this; + } + + ResourcePoolImpl( + ResourcePoolInner innerObject, + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.resourcePoolName = Utils.getValueFromIdByName(innerObject.id(), "resourcePools"); + } + + public ResourcePool refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getResourcePools() + .getByResourceGroupWithResponse(resourceGroupName, resourcePoolName, Context.NONE) + .getValue(); + return this; + } + + public ResourcePool refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getResourcePools() + .getByResourceGroupWithResponse(resourceGroupName, resourcePoolName, context) + .getValue(); + return this; + } + + public ResourcePoolImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ResourcePoolImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ResourcePoolImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public ResourcePoolImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public ResourcePoolImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } + + public ResourcePoolImpl withVCenterId(String vCenterId) { + this.innerModel().withVCenterId(vCenterId); + return this; + } + + public ResourcePoolImpl withMoRefId(String moRefId) { + this.innerModel().withMoRefId(moRefId); + return this; + } + + public ResourcePoolImpl withInventoryItemId(String inventoryItemId) { + this.innerModel().withInventoryItemId(inventoryItemId); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ResourcePoolsClientImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ResourcePoolsClientImpl.java new file mode 100644 index 000000000000..899e3447f2b0 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ResourcePoolsClientImpl.java @@ -0,0 +1,1540 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.ResourcePoolsClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.ResourcePoolInner; +import com.azure.resourcemanager.connectedvmware.models.ResourcePatch; +import com.azure.resourcemanager.connectedvmware.models.ResourcePoolsList; +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 ResourcePoolsClient. */ +public final class ResourcePoolsClientImpl implements ResourcePoolsClient { + /** The proxy service used to perform REST calls. */ + private final ResourcePoolsService service; + + /** The service client containing this operation class. */ + private final ConnectedVMwareClientImpl client; + + /** + * Initializes an instance of ResourcePoolsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourcePoolsClientImpl(ConnectedVMwareClientImpl client) { + this.service = + RestProxy.create(ResourcePoolsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConnectedVMwareClientResourcePools to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConnectedVMwareClien") + private interface ResourcePoolsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/resourcePools/{resourcePoolName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourcePoolName") String resourcePoolName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResourcePoolInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/resourcePools/{resourcePoolName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourcePoolName") String resourcePoolName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/resourcePools/{resourcePoolName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourcePoolName") String resourcePoolName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResourcePatch body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/resourcePools/{resourcePoolName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourcePoolName") String resourcePoolName, + @QueryParam("api-version") String apiVersion, + @QueryParam("force") Boolean force, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/resourcePools") + @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( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/resourcePools") + @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("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create Or Update resourcePool. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @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 define the resourcePool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String resourcePoolName, ResourcePoolInner 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 (resourcePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourcePoolName 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, + resourcePoolName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create Or Update resourcePool. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @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 define the resourcePool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String resourcePoolName, ResourcePoolInner 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 (resourcePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourcePoolName 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, + resourcePoolName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Create Or Update resourcePool. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @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 define the resourcePool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ResourcePoolInner> beginCreateAsync( + String resourceGroupName, String resourcePoolName, ResourcePoolInner body) { + Mono>> mono = createWithResponseAsync(resourceGroupName, resourcePoolName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ResourcePoolInner.class, + ResourcePoolInner.class, + this.client.getContext()); + } + + /** + * Create Or Update resourcePool. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @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 define the resourcePool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ResourcePoolInner> beginCreateAsync( + String resourceGroupName, String resourcePoolName, ResourcePoolInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, resourcePoolName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ResourcePoolInner.class, ResourcePoolInner.class, context); + } + + /** + * Create Or Update resourcePool. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @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 define the resourcePool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ResourcePoolInner> beginCreate( + String resourceGroupName, String resourcePoolName, ResourcePoolInner body) { + return beginCreateAsync(resourceGroupName, resourcePoolName, body).getSyncPoller(); + } + + /** + * Create Or Update resourcePool. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @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 define the resourcePool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ResourcePoolInner> beginCreate( + String resourceGroupName, String resourcePoolName, ResourcePoolInner body, Context context) { + return beginCreateAsync(resourceGroupName, resourcePoolName, body, context).getSyncPoller(); + } + + /** + * Create Or Update resourcePool. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @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 define the resourcePool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String resourcePoolName, ResourcePoolInner body) { + return beginCreateAsync(resourceGroupName, resourcePoolName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update resourcePool. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the resourcePool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String resourcePoolName) { + final ResourcePoolInner body = null; + return beginCreateAsync(resourceGroupName, resourcePoolName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update resourcePool. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @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 define the resourcePool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String resourcePoolName, ResourcePoolInner body, Context context) { + return beginCreateAsync(resourceGroupName, resourcePoolName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update resourcePool. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @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 define the resourcePool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourcePoolInner create(String resourceGroupName, String resourcePoolName, ResourcePoolInner body) { + return createAsync(resourceGroupName, resourcePoolName, body).block(); + } + + /** + * Create Or Update resourcePool. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the resourcePool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourcePoolInner create(String resourceGroupName, String resourcePoolName) { + final ResourcePoolInner body = null; + return createAsync(resourceGroupName, resourcePoolName, body).block(); + } + + /** + * Create Or Update resourcePool. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @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 define the resourcePool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourcePoolInner create( + String resourceGroupName, String resourcePoolName, ResourcePoolInner body, Context context) { + return createAsync(resourceGroupName, resourcePoolName, body, context).block(); + } + + /** + * Implements resourcePool GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the resourcePool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String resourcePoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourcePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourcePoolName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourcePoolName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements resourcePool GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the resourcePool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String resourcePoolName, 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 (resourcePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourcePoolName 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, + resourcePoolName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Implements resourcePool GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the resourcePool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String resourcePoolName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourcePoolName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Implements resourcePool GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the resourcePool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourcePoolInner getByResourceGroup(String resourceGroupName, String resourcePoolName) { + return getByResourceGroupAsync(resourceGroupName, resourcePoolName).block(); + } + + /** + * Implements resourcePool GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the resourcePool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String resourcePoolName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourcePoolName, context).block(); + } + + /** + * API to update certain properties of the resourcePool resource. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param body Resource properties to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the resourcePool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String resourcePoolName, ResourcePatch 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 (resourcePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourcePoolName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourcePoolName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * API to update certain properties of the resourcePool resource. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the resourcePool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String resourcePoolName, 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourcePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourcePoolName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourcePoolName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * API to update certain properties of the resourcePool resource. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param body Resource properties to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the resourcePool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String resourcePoolName, ResourcePatch body) { + return updateWithResponseAsync(resourceGroupName, resourcePoolName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * API to update certain properties of the resourcePool resource. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the resourcePool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String resourcePoolName) { + final ResourcePatch body = null; + return updateWithResponseAsync(resourceGroupName, resourcePoolName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * API to update certain properties of the resourcePool resource. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the resourcePool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourcePoolInner update(String resourceGroupName, String resourcePoolName) { + final ResourcePatch body = null; + return updateAsync(resourceGroupName, resourcePoolName, body).block(); + } + + /** + * API to update certain properties of the resourcePool resource. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the resourcePool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String resourcePoolName, ResourcePatch body, Context context) { + return updateWithResponseAsync(resourceGroupName, resourcePoolName, body, context).block(); + } + + /** + * Implements resourcePool DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 resourcePoolName, 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 (resourcePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourcePoolName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourcePoolName, + this.client.getApiVersion(), + force, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements resourcePool DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 resourcePoolName, 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 (resourcePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourcePoolName 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, + resourcePoolName, + this.client.getApiVersion(), + force, + accept, + context); + } + + /** + * Implements resourcePool DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 resourcePoolName, Boolean force) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, resourcePoolName, force); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Implements resourcePool DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 resourcePoolName, Boolean force, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, resourcePoolName, force, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Implements resourcePool DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 resourcePoolName, Boolean force) { + return beginDeleteAsync(resourceGroupName, resourcePoolName, force).getSyncPoller(); + } + + /** + * Implements resourcePool DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 resourcePoolName, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, resourcePoolName, force, context).getSyncPoller(); + } + + /** + * Implements resourcePool DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourcePoolName, Boolean force) { + return beginDeleteAsync(resourceGroupName, resourcePoolName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Implements resourcePool DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourcePoolName) { + final Boolean force = null; + return beginDeleteAsync(resourceGroupName, resourcePoolName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Implements resourcePool DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourcePoolName, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, resourcePoolName, force, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Implements resourcePool DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 resourcePoolName, Boolean force) { + deleteAsync(resourceGroupName, resourcePoolName, force).block(); + } + + /** + * Implements resourcePool DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 resourcePoolName) { + final Boolean force = null; + deleteAsync(resourceGroupName, resourcePoolName, force).block(); + } + + /** + * Implements resourcePool DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 resourcePoolName, Boolean force, Context context) { + deleteAsync(resourceGroupName, resourcePoolName, force, context).block(); + } + + /** + * List of resourcePools 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 ResourcePools 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 resourcePools 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 ResourcePools 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 resourcePools 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 ResourcePools as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List of resourcePools 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 ResourcePools as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List of resourcePools 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 ResourcePools as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List of resourcePools 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 ResourcePools as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List of resourcePools in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ResourcePools 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 resourcePools in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ResourcePools 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 resourcePools in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ResourcePools 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 resourcePools in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ResourcePools 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 resourcePools in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ResourcePools as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List of resourcePools in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ResourcePools as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ResourcePools 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 list of ResourcePools along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ResourcePools 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 ResourcePools along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ResourcePoolsImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ResourcePoolsImpl.java new file mode 100644 index 000000000000..98ac6cde5b00 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/ResourcePoolsImpl.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.ResourcePoolsClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.ResourcePoolInner; +import com.azure.resourcemanager.connectedvmware.models.ResourcePool; +import com.azure.resourcemanager.connectedvmware.models.ResourcePools; + +public final class ResourcePoolsImpl implements ResourcePools { + private static final ClientLogger LOGGER = new ClientLogger(ResourcePoolsImpl.class); + + private final ResourcePoolsClient innerClient; + + private final com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager; + + public ResourcePoolsImpl( + ResourcePoolsClient innerClient, + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ResourcePool getByResourceGroup(String resourceGroupName, String resourcePoolName) { + ResourcePoolInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, resourcePoolName); + if (inner != null) { + return new ResourcePoolImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String resourcePoolName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, resourcePoolName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ResourcePoolImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String resourcePoolName, Boolean force) { + this.serviceClient().delete(resourceGroupName, resourcePoolName, force); + } + + public void delete(String resourceGroupName, String resourcePoolName) { + this.serviceClient().delete(resourceGroupName, resourcePoolName); + } + + public void delete(String resourceGroupName, String resourcePoolName, Boolean force, Context context) { + this.serviceClient().delete(resourceGroupName, resourcePoolName, force, context); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ResourcePoolImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ResourcePoolImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ResourcePoolImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ResourcePoolImpl(inner1, this.manager())); + } + + public ResourcePool 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 resourcePoolName = Utils.getValueFromIdByName(id, "resourcePools"); + if (resourcePoolName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourcePools'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourcePoolName, 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 resourcePoolName = Utils.getValueFromIdByName(id, "resourcePools"); + if (resourcePoolName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourcePools'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourcePoolName, 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 resourcePoolName = Utils.getValueFromIdByName(id, "resourcePools"); + if (resourcePoolName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourcePools'.", id))); + } + Boolean localForce = null; + this.delete(resourceGroupName, resourcePoolName, 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 resourcePoolName = Utils.getValueFromIdByName(id, "resourcePools"); + if (resourcePoolName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourcePools'.", id))); + } + this.delete(resourceGroupName, resourcePoolName, force, context); + } + + private ResourcePoolsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } + + public ResourcePoolImpl define(String name) { + return new ResourcePoolImpl(name, this.manager()); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/Utils.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/Utils.java new file mode 100644 index 000000000000..30060abd4e2e --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VCenterImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VCenterImpl.java new file mode 100644 index 000000000000..c4748b3ab13d --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VCenterImpl.java @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.fluent.models.VCenterInner; +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; +import com.azure.resourcemanager.connectedvmware.models.ResourcePatch; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.azure.resourcemanager.connectedvmware.models.VCenter; +import com.azure.resourcemanager.connectedvmware.models.VICredential; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class VCenterImpl implements VCenter, VCenter.Definition, VCenter.Update { + private VCenterInner innerObject; + + private final com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String uuid() { + return this.innerModel().uuid(); + } + + public String fqdn() { + return this.innerModel().fqdn(); + } + + public Integer port() { + return this.innerModel().port(); + } + + public String version() { + return this.innerModel().version(); + } + + public String instanceUuid() { + return this.innerModel().instanceUuid(); + } + + public String connectionStatus() { + return this.innerModel().connectionStatus(); + } + + public String customResourceName() { + return this.innerModel().customResourceName(); + } + + public VICredential credentials() { + return this.innerModel().credentials(); + } + + public List statuses() { + List inner = this.innerModel().statuses(); + 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 VCenterInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String vcenterName; + + private ResourcePatch updateBody; + + public VCenterImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public VCenter create() { + this.innerObject = + serviceManager + .serviceClient() + .getVCenters() + .create(resourceGroupName, vcenterName, this.innerModel(), Context.NONE); + return this; + } + + public VCenter create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVCenters() + .create(resourceGroupName, vcenterName, this.innerModel(), context); + return this; + } + + VCenterImpl(String name, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerObject = new VCenterInner(); + this.serviceManager = serviceManager; + this.vcenterName = name; + } + + public VCenterImpl update() { + this.updateBody = new ResourcePatch(); + return this; + } + + public VCenter apply() { + this.innerObject = + serviceManager + .serviceClient() + .getVCenters() + .updateWithResponse(resourceGroupName, vcenterName, updateBody, Context.NONE) + .getValue(); + return this; + } + + public VCenter apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVCenters() + .updateWithResponse(resourceGroupName, vcenterName, updateBody, context) + .getValue(); + return this; + } + + VCenterImpl( + VCenterInner innerObject, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.vcenterName = Utils.getValueFromIdByName(innerObject.id(), "vcenters"); + } + + public VCenter refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getVCenters() + .getByResourceGroupWithResponse(resourceGroupName, vcenterName, Context.NONE) + .getValue(); + return this; + } + + public VCenter refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVCenters() + .getByResourceGroupWithResponse(resourceGroupName, vcenterName, context) + .getValue(); + return this; + } + + public VCenterImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public VCenterImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public VCenterImpl withFqdn(String fqdn) { + this.innerModel().withFqdn(fqdn); + return this; + } + + public VCenterImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public VCenterImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public VCenterImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } + + public VCenterImpl withPort(Integer port) { + this.innerModel().withPort(port); + return this; + } + + public VCenterImpl withCredentials(VICredential credentials) { + this.innerModel().withCredentials(credentials); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VCentersClientImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VCentersClientImpl.java new file mode 100644 index 000000000000..1c6e3af3729e --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VCentersClientImpl.java @@ -0,0 +1,1521 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.VCentersClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.VCenterInner; +import com.azure.resourcemanager.connectedvmware.models.ResourcePatch; +import com.azure.resourcemanager.connectedvmware.models.VCentersList; +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 VCentersClient. */ +public final class VCentersClientImpl implements VCentersClient { + /** The proxy service used to perform REST calls. */ + private final VCentersService service; + + /** The service client containing this operation class. */ + private final ConnectedVMwareClientImpl client; + + /** + * Initializes an instance of VCentersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VCentersClientImpl(ConnectedVMwareClientImpl client) { + this.service = RestProxy.create(VCentersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConnectedVMwareClientVCenters to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConnectedVMwareClien") + private interface VCentersService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/vcenters/{vcenterName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vcenterName") String vcenterName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") VCenterInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/vcenters/{vcenterName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vcenterName") String vcenterName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/vcenters/{vcenterName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vcenterName") String vcenterName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResourcePatch body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/vcenters/{vcenterName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("vcenterName") String vcenterName, + @QueryParam("api-version") String apiVersion, + @QueryParam("force") Boolean force, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/vcenters") + @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( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/vcenters") + @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("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create Or Update vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vCenter along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String vcenterName, VCenterInner 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 (vcenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter vcenterName 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, + vcenterName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create Or Update vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vCenter along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String vcenterName, VCenterInner 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 (vcenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter vcenterName 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, + vcenterName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Create Or Update vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 defines the vCenter. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VCenterInner> beginCreateAsync( + String resourceGroupName, String vcenterName, VCenterInner body) { + Mono>> mono = createWithResponseAsync(resourceGroupName, vcenterName, body); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), VCenterInner.class, VCenterInner.class, this.client.getContext()); + } + + /** + * Create Or Update vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 defines the vCenter. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VCenterInner> beginCreateAsync( + String resourceGroupName, String vcenterName, VCenterInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createWithResponseAsync(resourceGroupName, vcenterName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), VCenterInner.class, VCenterInner.class, context); + } + + /** + * Create Or Update vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 defines the vCenter. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VCenterInner> beginCreate( + String resourceGroupName, String vcenterName, VCenterInner body) { + return beginCreateAsync(resourceGroupName, vcenterName, body).getSyncPoller(); + } + + /** + * Create Or Update vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 defines the vCenter. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VCenterInner> beginCreate( + String resourceGroupName, String vcenterName, VCenterInner body, Context context) { + return beginCreateAsync(resourceGroupName, vcenterName, body, context).getSyncPoller(); + } + + /** + * Create Or Update vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vCenter on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String vcenterName, VCenterInner body) { + return beginCreateAsync(resourceGroupName, vcenterName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vCenter on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String vcenterName) { + final VCenterInner body = null; + return beginCreateAsync(resourceGroupName, vcenterName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vCenter on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String vcenterName, VCenterInner body, Context context) { + return beginCreateAsync(resourceGroupName, vcenterName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vCenter. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VCenterInner create(String resourceGroupName, String vcenterName, VCenterInner body) { + return createAsync(resourceGroupName, vcenterName, body).block(); + } + + /** + * Create Or Update vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vCenter. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VCenterInner create(String resourceGroupName, String vcenterName) { + final VCenterInner body = null; + return createAsync(resourceGroupName, vcenterName, body).block(); + } + + /** + * Create Or Update vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vCenter. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VCenterInner create(String resourceGroupName, String vcenterName, VCenterInner body, Context context) { + return createAsync(resourceGroupName, vcenterName, body, context).block(); + } + + /** + * Implements vCenter GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vCenter along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String vcenterName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vcenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter vcenterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vcenterName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements vCenter GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vCenter along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String vcenterName, 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 (vcenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter vcenterName 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, + vcenterName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Implements vCenter GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vCenter on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String vcenterName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, vcenterName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Implements vCenter GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vCenter. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VCenterInner getByResourceGroup(String resourceGroupName, String vcenterName) { + return getByResourceGroupAsync(resourceGroupName, vcenterName).block(); + } + + /** + * Implements vCenter GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vCenter along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String vcenterName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, vcenterName, context).block(); + } + + /** + * API to update certain properties of the vCenter resource. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param body Resource properties to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vCenter along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String vcenterName, ResourcePatch 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 (vcenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter vcenterName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vcenterName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * API to update certain properties of the vCenter resource. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vCenter along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String vcenterName, 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (vcenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter vcenterName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vcenterName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * API to update certain properties of the vCenter resource. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param body Resource properties to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vCenter on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String vcenterName, ResourcePatch body) { + return updateWithResponseAsync(resourceGroupName, vcenterName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * API to update certain properties of the vCenter resource. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vCenter on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String vcenterName) { + final ResourcePatch body = null; + return updateWithResponseAsync(resourceGroupName, vcenterName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * API to update certain properties of the vCenter resource. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vCenter. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VCenterInner update(String resourceGroupName, String vcenterName) { + final ResourcePatch body = null; + return updateAsync(resourceGroupName, vcenterName, body).block(); + } + + /** + * API to update certain properties of the vCenter resource. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 vCenter along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String vcenterName, ResourcePatch body, Context context) { + return updateWithResponseAsync(resourceGroupName, vcenterName, body, context).block(); + } + + /** + * Implements vCenter DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 vcenterName, 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 (vcenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter vcenterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + vcenterName, + this.client.getApiVersion(), + force, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements vCenter DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 vcenterName, 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 (vcenterName == null) { + return Mono.error(new IllegalArgumentException("Parameter vcenterName 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, + vcenterName, + this.client.getApiVersion(), + force, + accept, + context); + } + + /** + * Implements vCenter DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 vcenterName, Boolean force) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, vcenterName, force); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Implements vCenter DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 vcenterName, Boolean force, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, vcenterName, force, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Implements vCenter DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 vcenterName, Boolean force) { + return beginDeleteAsync(resourceGroupName, vcenterName, force).getSyncPoller(); + } + + /** + * Implements vCenter DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 vcenterName, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, vcenterName, force, context).getSyncPoller(); + } + + /** + * Implements vCenter DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 vcenterName, Boolean force) { + return beginDeleteAsync(resourceGroupName, vcenterName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Implements vCenter DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 vcenterName) { + final Boolean force = null; + return beginDeleteAsync(resourceGroupName, vcenterName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Implements vCenter DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 vcenterName, Boolean force, Context context) { + return beginDeleteAsync(resourceGroupName, vcenterName, force, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Implements vCenter DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 vcenterName, Boolean force) { + deleteAsync(resourceGroupName, vcenterName, force).block(); + } + + /** + * Implements vCenter DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 vcenterName) { + final Boolean force = null; + deleteAsync(resourceGroupName, vcenterName, force).block(); + } + + /** + * Implements vCenter DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 vcenterName, Boolean force, Context context) { + deleteAsync(resourceGroupName, vcenterName, force, context).block(); + } + + /** + * List of vCenters 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 VCenters 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 vCenters 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 VCenters 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 vCenters 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 VCenters as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List of vCenters 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 VCenters as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List of vCenters 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 VCenters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List of vCenters 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 VCenters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List of vCenters in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 VCenters 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 vCenters in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 VCenters 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 vCenters in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 VCenters 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 vCenters in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 VCenters 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 vCenters in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 VCenters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List of vCenters in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 VCenters as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 VCenters 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 list of VCenters along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 VCenters 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 VCenters along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VCentersImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VCentersImpl.java new file mode 100644 index 000000000000..fb3399d0d5dd --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VCentersImpl.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.VCentersClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.VCenterInner; +import com.azure.resourcemanager.connectedvmware.models.VCenter; +import com.azure.resourcemanager.connectedvmware.models.VCenters; + +public final class VCentersImpl implements VCenters { + private static final ClientLogger LOGGER = new ClientLogger(VCentersImpl.class); + + private final VCentersClient innerClient; + + private final com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager; + + public VCentersImpl( + VCentersClient innerClient, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public VCenter getByResourceGroup(String resourceGroupName, String vcenterName) { + VCenterInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, vcenterName); + if (inner != null) { + return new VCenterImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String vcenterName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, vcenterName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VCenterImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String vcenterName, Boolean force) { + this.serviceClient().delete(resourceGroupName, vcenterName, force); + } + + public void delete(String resourceGroupName, String vcenterName) { + this.serviceClient().delete(resourceGroupName, vcenterName); + } + + public void delete(String resourceGroupName, String vcenterName, Boolean force, Context context) { + this.serviceClient().delete(resourceGroupName, vcenterName, force, context); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new VCenterImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new VCenterImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new VCenterImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new VCenterImpl(inner1, this.manager())); + } + + public VCenter 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 vcenterName = Utils.getValueFromIdByName(id, "vcenters"); + if (vcenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vcenters'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, vcenterName, 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 vcenterName = Utils.getValueFromIdByName(id, "vcenters"); + if (vcenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vcenters'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, vcenterName, 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 vcenterName = Utils.getValueFromIdByName(id, "vcenters"); + if (vcenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vcenters'.", id))); + } + Boolean localForce = null; + this.delete(resourceGroupName, vcenterName, 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 vcenterName = Utils.getValueFromIdByName(id, "vcenters"); + if (vcenterName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'vcenters'.", id))); + } + this.delete(resourceGroupName, vcenterName, force, context); + } + + private VCentersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } + + public VCenterImpl define(String name) { + return new VCenterImpl(name, this.manager()); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualMachineImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualMachineImpl.java new file mode 100644 index 000000000000..bff1d00ddf1b --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualMachineImpl.java @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.fluent.models.VirtualMachineInner; +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; +import com.azure.resourcemanager.connectedvmware.models.FirmwareType; +import com.azure.resourcemanager.connectedvmware.models.GuestAgentProfile; +import com.azure.resourcemanager.connectedvmware.models.HardwareProfile; +import com.azure.resourcemanager.connectedvmware.models.Identity; +import com.azure.resourcemanager.connectedvmware.models.NetworkProfile; +import com.azure.resourcemanager.connectedvmware.models.NetworkProfileUpdate; +import com.azure.resourcemanager.connectedvmware.models.OsProfile; +import com.azure.resourcemanager.connectedvmware.models.PlacementProfile; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.azure.resourcemanager.connectedvmware.models.StopVirtualMachineOptions; +import com.azure.resourcemanager.connectedvmware.models.StorageProfile; +import com.azure.resourcemanager.connectedvmware.models.StorageProfileUpdate; +import com.azure.resourcemanager.connectedvmware.models.VirtualMachine; +import com.azure.resourcemanager.connectedvmware.models.VirtualMachineUpdate; +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.connectedvmware.ConnectedVMwareManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public Identity identity() { + return this.innerModel().identity(); + } + + public String resourcePoolId() { + return this.innerModel().resourcePoolId(); + } + + public String templateId() { + return this.innerModel().templateId(); + } + + public String vCenterId() { + return this.innerModel().vCenterId(); + } + + public PlacementProfile placementProfile() { + return this.innerModel().placementProfile(); + } + + 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 GuestAgentProfile guestAgentProfile() { + return this.innerModel().guestAgentProfile(); + } + + public String moRefId() { + return this.innerModel().moRefId(); + } + + public String inventoryItemId() { + return this.innerModel().inventoryItemId(); + } + + public String moName() { + return this.innerModel().moName(); + } + + public String folderPath() { + return this.innerModel().folderPath(); + } + + public String instanceUuid() { + return this.innerModel().instanceUuid(); + } + + public String smbiosUuid() { + return this.innerModel().smbiosUuid(); + } + + public FirmwareType firmwareType() { + return this.innerModel().firmwareType(); + } + + public String powerState() { + return this.innerModel().powerState(); + } + + public String customResourceName() { + return this.innerModel().customResourceName(); + } + + public String uuid() { + return this.innerModel().uuid(); + } + + public List statuses() { + List inner = this.innerModel().statuses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String vmId() { + return this.innerModel().vmId(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public VirtualMachineInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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() + .create(resourceGroupName, virtualMachineName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualMachine create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachines() + .create(resourceGroupName, virtualMachineName, this.innerModel(), context); + return this; + } + + VirtualMachineImpl(String name, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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.connectedvmware.ConnectedVMwareManager 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 VirtualMachineImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public VirtualMachineImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public VirtualMachineImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public VirtualMachineImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public VirtualMachineImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } + + public VirtualMachineImpl withIdentity(Identity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateBody.withIdentity(identity); + return this; + } + } + + public VirtualMachineImpl withResourcePoolId(String resourcePoolId) { + this.innerModel().withResourcePoolId(resourcePoolId); + return this; + } + + public VirtualMachineImpl withTemplateId(String templateId) { + this.innerModel().withTemplateId(templateId); + return this; + } + + public VirtualMachineImpl withVCenterId(String vCenterId) { + this.innerModel().withVCenterId(vCenterId); + return this; + } + + public VirtualMachineImpl withPlacementProfile(PlacementProfile placementProfile) { + this.innerModel().withPlacementProfile(placementProfile); + return this; + } + + public VirtualMachineImpl withOsProfile(OsProfile osProfile) { + this.innerModel().withOsProfile(osProfile); + return this; + } + + public VirtualMachineImpl withHardwareProfile(HardwareProfile hardwareProfile) { + if (isInCreateMode()) { + this.innerModel().withHardwareProfile(hardwareProfile); + return this; + } else { + this.updateBody.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 withGuestAgentProfile(GuestAgentProfile guestAgentProfile) { + this.innerModel().withGuestAgentProfile(guestAgentProfile); + return this; + } + + public VirtualMachineImpl withMoRefId(String moRefId) { + this.innerModel().withMoRefId(moRefId); + return this; + } + + public VirtualMachineImpl withInventoryItemId(String inventoryItemId) { + this.innerModel().withInventoryItemId(inventoryItemId); + return this; + } + + public VirtualMachineImpl withSmbiosUuid(String smbiosUuid) { + this.innerModel().withSmbiosUuid(smbiosUuid); + return this; + } + + public VirtualMachineImpl withFirmwareType(FirmwareType firmwareType) { + this.innerModel().withFirmwareType(firmwareType); + return this; + } + + public VirtualMachineImpl withStorageProfile(StorageProfileUpdate storageProfile) { + this.updateBody.withStorageProfile(storageProfile); + return this; + } + + public VirtualMachineImpl withNetworkProfile(NetworkProfileUpdate networkProfile) { + this.updateBody.withNetworkProfile(networkProfile); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualMachineTemplateImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualMachineTemplateImpl.java new file mode 100644 index 000000000000..db239f4f0e1d --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualMachineTemplateImpl.java @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.fluent.models.VirtualMachineTemplateInner; +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; +import com.azure.resourcemanager.connectedvmware.models.FirmwareType; +import com.azure.resourcemanager.connectedvmware.models.NetworkInterface; +import com.azure.resourcemanager.connectedvmware.models.OsType; +import com.azure.resourcemanager.connectedvmware.models.ResourcePatch; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.azure.resourcemanager.connectedvmware.models.VirtualDisk; +import com.azure.resourcemanager.connectedvmware.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.connectedvmware.ConnectedVMwareManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String uuid() { + return this.innerModel().uuid(); + } + + public String vCenterId() { + return this.innerModel().vCenterId(); + } + + public String moRefId() { + return this.innerModel().moRefId(); + } + + public String inventoryItemId() { + return this.innerModel().inventoryItemId(); + } + + public String moName() { + return this.innerModel().moName(); + } + + public Integer memorySizeMB() { + return this.innerModel().memorySizeMB(); + } + + public Integer numCPUs() { + return this.innerModel().numCPUs(); + } + + public Integer numCoresPerSocket() { + return this.innerModel().numCoresPerSocket(); + } + + public OsType osType() { + return this.innerModel().osType(); + } + + public String osName() { + return this.innerModel().osName(); + } + + public String folderPath() { + return this.innerModel().folderPath(); + } + + 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 customResourceName() { + return this.innerModel().customResourceName(); + } + + public String toolsVersionStatus() { + return this.innerModel().toolsVersionStatus(); + } + + public String toolsVersion() { + return this.innerModel().toolsVersion(); + } + + public FirmwareType firmwareType() { + return this.innerModel().firmwareType(); + } + + public List statuses() { + List inner = this.innerModel().statuses(); + 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.connectedvmware.ConnectedVMwareManager 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() + .create(resourceGroupName, virtualMachineTemplateName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualMachineTemplate create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineTemplates() + .create(resourceGroupName, virtualMachineTemplateName, this.innerModel(), context); + return this; + } + + VirtualMachineTemplateImpl( + String name, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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() + .updateWithResponse(resourceGroupName, virtualMachineTemplateName, updateBody, Context.NONE) + .getValue(); + return this; + } + + public VirtualMachineTemplate apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineTemplates() + .updateWithResponse(resourceGroupName, virtualMachineTemplateName, updateBody, context) + .getValue(); + return this; + } + + VirtualMachineTemplateImpl( + VirtualMachineTemplateInner innerObject, + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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 withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public VirtualMachineTemplateImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public VirtualMachineTemplateImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } + + public VirtualMachineTemplateImpl withVCenterId(String vCenterId) { + this.innerModel().withVCenterId(vCenterId); + return this; + } + + public VirtualMachineTemplateImpl withMoRefId(String moRefId) { + this.innerModel().withMoRefId(moRefId); + return this; + } + + public VirtualMachineTemplateImpl withInventoryItemId(String inventoryItemId) { + this.innerModel().withInventoryItemId(inventoryItemId); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualMachineTemplatesClientImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualMachineTemplatesClientImpl.java new file mode 100644 index 000000000000..982a45f7f558 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualMachineTemplatesClientImpl.java @@ -0,0 +1,1591 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.VirtualMachineTemplatesClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.VirtualMachineTemplateInner; +import com.azure.resourcemanager.connectedvmware.models.ResourcePatch; +import com.azure.resourcemanager.connectedvmware.models.VirtualMachineTemplatesList; +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 ConnectedVMwareClientImpl client; + + /** + * Initializes an instance of VirtualMachineTemplatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachineTemplatesClientImpl(ConnectedVMwareClientImpl client) { + this.service = + RestProxy + .create(VirtualMachineTemplatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConnectedVMwareClientVirtualMachineTemplates to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConnectedVMwareClien") + private interface VirtualMachineTemplatesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualMachineTemplates/{virtualMachineTemplateName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @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"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/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"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualMachineTemplates/{virtualMachineTemplateName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualMachineTemplateName") String virtualMachineTemplateName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResourcePatch body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/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"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/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( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/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("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create Or Update virtual machine template. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @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 define the virtualMachineTemplate along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + 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) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineTemplateName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create Or Update virtual machine template. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @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 define the virtualMachineTemplate along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + 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) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineTemplateName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Create Or Update virtual machine template. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @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 define the virtualMachineTemplate. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineTemplateInner> beginCreateAsync( + String resourceGroupName, String virtualMachineTemplateName, VirtualMachineTemplateInner body) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, virtualMachineTemplateName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineTemplateInner.class, + VirtualMachineTemplateInner.class, + this.client.getContext()); + } + + /** + * Create Or Update virtual machine template. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @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 define the virtualMachineTemplate. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineTemplateInner> beginCreateAsync( + String resourceGroupName, + String virtualMachineTemplateName, + VirtualMachineTemplateInner body, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, virtualMachineTemplateName, body, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineTemplateInner.class, + VirtualMachineTemplateInner.class, + context); + } + + /** + * Create Or Update virtual machine template. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @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 define the virtualMachineTemplate. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineTemplateInner> beginCreate( + String resourceGroupName, String virtualMachineTemplateName, VirtualMachineTemplateInner body) { + return beginCreateAsync(resourceGroupName, virtualMachineTemplateName, body).getSyncPoller(); + } + + /** + * Create Or Update virtual machine template. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @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 define the virtualMachineTemplate. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineTemplateInner> beginCreate( + String resourceGroupName, + String virtualMachineTemplateName, + VirtualMachineTemplateInner body, + Context context) { + return beginCreateAsync(resourceGroupName, virtualMachineTemplateName, body, context).getSyncPoller(); + } + + /** + * Create Or Update virtual machine template. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @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 define the virtualMachineTemplate on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String virtualMachineTemplateName, VirtualMachineTemplateInner body) { + return beginCreateAsync(resourceGroupName, virtualMachineTemplateName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update virtual machine template. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachineTemplate on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String virtualMachineTemplateName) { + final VirtualMachineTemplateInner body = null; + return beginCreateAsync(resourceGroupName, virtualMachineTemplateName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update virtual machine template. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @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 define the virtualMachineTemplate on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String virtualMachineTemplateName, + VirtualMachineTemplateInner body, + Context context) { + return beginCreateAsync(resourceGroupName, virtualMachineTemplateName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update virtual machine template. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @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 define the virtualMachineTemplate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineTemplateInner create( + String resourceGroupName, String virtualMachineTemplateName, VirtualMachineTemplateInner body) { + return createAsync(resourceGroupName, virtualMachineTemplateName, body).block(); + } + + /** + * Create Or Update virtual machine template. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachineTemplate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineTemplateInner create(String resourceGroupName, String virtualMachineTemplateName) { + final VirtualMachineTemplateInner body = null; + return createAsync(resourceGroupName, virtualMachineTemplateName, body).block(); + } + + /** + * Create Or Update virtual machine template. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @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 define the virtualMachineTemplate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineTemplateInner create( + String resourceGroupName, + String virtualMachineTemplateName, + VirtualMachineTemplateInner body, + Context context) { + return createAsync(resourceGroupName, virtualMachineTemplateName, body, context).block(); + } + + /** + * Implements virtual machine template GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachineTemplate 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 virtual machine template GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachineTemplate 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 virtual machine template GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachineTemplate 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 virtual machine template GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachineTemplate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineTemplateInner getByResourceGroup(String resourceGroupName, String virtualMachineTemplateName) { + return getByResourceGroupAsync(resourceGroupName, virtualMachineTemplateName).block(); + } + + /** + * Implements virtual machine template GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachineTemplate along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualMachineTemplateName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, virtualMachineTemplateName, context).block(); + } + + /** + * API to update certain properties of the virtual machine template resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param body Resource properties to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachineTemplate 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineTemplateName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * API to update certain properties of the virtual machine template resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachineTemplate 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineTemplateName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * API to update certain properties of the virtual machine template resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param body Resource properties to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachineTemplate on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String virtualMachineTemplateName, ResourcePatch body) { + return updateWithResponseAsync(resourceGroupName, virtualMachineTemplateName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * API to update certain properties of the virtual machine template resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachineTemplate on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String virtualMachineTemplateName) { + final ResourcePatch body = null; + return updateWithResponseAsync(resourceGroupName, virtualMachineTemplateName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * API to update certain properties of the virtual machine template resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachineTemplate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineTemplateInner update(String resourceGroupName, String virtualMachineTemplateName) { + final ResourcePatch body = null; + return updateAsync(resourceGroupName, virtualMachineTemplateName, body).block(); + } + + /** + * API to update certain properties of the virtual machine template resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachineTemplate along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String virtualMachineTemplateName, ResourcePatch body, Context context) { + return updateWithResponseAsync(resourceGroupName, virtualMachineTemplateName, body, context).block(); + } + + /** + * Implements virtual machine template DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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())); + } + + /** + * Implements virtual machine template DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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); + } + + /** + * Implements virtual machine template DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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()); + } + + /** + * Implements virtual machine template DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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); + } + + /** + * Implements virtual machine template DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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(); + } + + /** + * Implements virtual machine template DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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(); + } + + /** + * Implements virtual machine template DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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); + } + + /** + * Implements virtual machine template DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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); + } + + /** + * Implements virtual machine template DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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); + } + + /** + * Implements virtual machine template DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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(); + } + + /** + * Implements virtual machine template DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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(); + } + + /** + * Implements virtual machine template DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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(); + } + + /** + * 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 -> listNextSinglePageAsync(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 -> listNextSinglePageAsync(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)); + } + + /** + * List of virtualMachineTemplates in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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)); + } + + /** + * 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> 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 list of VirtualMachineTemplates along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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)); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualMachineTemplatesImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualMachineTemplatesImpl.java new file mode 100644 index 000000000000..7447ea392ab4 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualMachineTemplatesImpl.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.VirtualMachineTemplatesClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.VirtualMachineTemplateInner; +import com.azure.resourcemanager.connectedvmware.models.VirtualMachineTemplate; +import com.azure.resourcemanager.connectedvmware.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.connectedvmware.ConnectedVMwareManager serviceManager; + + public VirtualMachineTemplatesImpl( + VirtualMachineTemplatesClient innerClient, + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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 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 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 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.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } + + public VirtualMachineTemplateImpl define(String name) { + return new VirtualMachineTemplateImpl(name, this.manager()); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualMachinesClientImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualMachinesClientImpl.java new file mode 100644 index 000000000000..60a8eb2f3b80 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualMachinesClientImpl.java @@ -0,0 +1,2451 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.VirtualMachinesClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.VirtualMachineInner; +import com.azure.resourcemanager.connectedvmware.models.StopVirtualMachineOptions; +import com.azure.resourcemanager.connectedvmware.models.VirtualMachineUpdate; +import com.azure.resourcemanager.connectedvmware.models.VirtualMachinesList; +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 ConnectedVMwareClientImpl client; + + /** + * Initializes an instance of VirtualMachinesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachinesClientImpl(ConnectedVMwareClientImpl client) { + this.service = + RestProxy.create(VirtualMachinesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConnectedVMwareClientVirtualMachines to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConnectedVMwareClien") + private interface VirtualMachinesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @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"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/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"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualMachineName") String virtualMachineName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") VirtualMachineUpdate body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/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("force") Boolean force, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/stop") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> stop( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualMachineName") String virtualMachineName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") StopVirtualMachineOptions body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/start") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> start( + @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"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/restart") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> restart( + @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"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/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( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/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("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create Or Update virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 define the virtualMachine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + 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) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create Or Update virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 define the virtualMachine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + 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) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Create Or Update virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineInner> beginCreateAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body) { + Mono>> mono = createWithResponseAsync(resourceGroupName, virtualMachineName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualMachineInner.class, + VirtualMachineInner.class, + this.client.getContext()); + } + + /** + * Create Or Update virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineInner> beginCreateAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, virtualMachineName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), VirtualMachineInner.class, VirtualMachineInner.class, context); + } + + /** + * Create Or Update virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineInner> beginCreate( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body) { + return beginCreateAsync(resourceGroupName, virtualMachineName, body).getSyncPoller(); + } + + /** + * Create Or Update virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineInner> beginCreate( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body, Context context) { + return beginCreateAsync(resourceGroupName, virtualMachineName, body, context).getSyncPoller(); + } + + /** + * Create Or Update virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 define the virtualMachine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body) { + return beginCreateAsync(resourceGroupName, virtualMachineName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String virtualMachineName) { + final VirtualMachineInner body = null; + return beginCreateAsync(resourceGroupName, virtualMachineName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 define the virtualMachine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body, Context context) { + return beginCreateAsync(resourceGroupName, virtualMachineName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInner create(String resourceGroupName, String virtualMachineName, VirtualMachineInner body) { + return createAsync(resourceGroupName, virtualMachineName, body).block(); + } + + /** + * Create Or Update virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInner create(String resourceGroupName, String virtualMachineName) { + final VirtualMachineInner body = null; + return createAsync(resourceGroupName, virtualMachineName, body).block(); + } + + /** + * Create Or Update virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInner create( + String resourceGroupName, String virtualMachineName, VirtualMachineInner body, Context context) { + return createAsync(resourceGroupName, virtualMachineName, body, context).block(); + } + + /** + * Implements virtual machine GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine 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 virtual machine GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine 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 virtual machine GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine 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 virtual machine GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInner getByResourceGroup(String resourceGroupName, String virtualMachineName) { + return getByResourceGroupAsync(resourceGroupName, virtualMachineName).block(); + } + + /** + * Implements virtual machine GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualMachineName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, virtualMachineName, context).block(); + } + + /** + * API to update certain properties of the virtual machine resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param body Resource properties to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * API to update certain properties of the virtual machine resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * API to update certain properties of the virtual machine resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param body Resource properties to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 define the virtualMachine. + */ + @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()); + } + + /** + * API to update certain properties of the virtual machine resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 define the virtualMachine. + */ + @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); + } + + /** + * API to update certain properties of the virtual machine resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param body Resource properties to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineInner> beginUpdate( + String resourceGroupName, String virtualMachineName, VirtualMachineUpdate body) { + return beginUpdateAsync(resourceGroupName, virtualMachineName, body).getSyncPoller(); + } + + /** + * API to update certain properties of the virtual machine resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of define the virtualMachine. + */ + @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(); + } + + /** + * API to update certain properties of the virtual machine resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param body Resource properties to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine 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); + } + + /** + * API to update certain properties of the virtual machine resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String virtualMachineName) { + final VirtualMachineUpdate body = null; + return beginUpdateAsync(resourceGroupName, virtualMachineName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * API to update certain properties of the virtual machine resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine 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); + } + + /** + * API to update certain properties of the virtual machine resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param body Resource properties to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInner update(String resourceGroupName, String virtualMachineName, VirtualMachineUpdate body) { + return updateAsync(resourceGroupName, virtualMachineName, body).block(); + } + + /** + * API to update certain properties of the virtual machine resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInner update(String resourceGroupName, String virtualMachineName) { + final VirtualMachineUpdate body = null; + return updateAsync(resourceGroupName, virtualMachineName, body).block(); + } + + /** + * API to update certain properties of the virtual machine resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInner update( + String resourceGroupName, String virtualMachineName, VirtualMachineUpdate body, Context context) { + return updateAsync(resourceGroupName, virtualMachineName, body, context).block(); + } + + /** + * Implements virtual machine DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 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(), + force, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements virtual machine DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 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(), + force, + accept, + context); + } + + /** + * Implements virtual machine DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 force) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, virtualMachineName, force); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Implements virtual machine DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 force, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, virtualMachineName, force, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Implements virtual machine DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 force) { + return beginDeleteAsync(resourceGroupName, virtualMachineName, force).getSyncPoller(); + } + + /** + * Implements virtual machine DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 force, Context context) { + return beginDeleteAsync(resourceGroupName, virtualMachineName, force, context).getSyncPoller(); + } + + /** + * Implements virtual machine DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 force) { + return beginDeleteAsync(resourceGroupName, virtualMachineName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Implements virtual machine DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 force = null; + return beginDeleteAsync(resourceGroupName, virtualMachineName, force) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Implements virtual machine DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 force, Context context) { + return beginDeleteAsync(resourceGroupName, virtualMachineName, force, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Implements virtual machine DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 force) { + deleteAsync(resourceGroupName, virtualMachineName, force).block(); + } + + /** + * Implements virtual machine DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 force = null; + deleteAsync(resourceGroupName, virtualMachineName, force).block(); + } + + /** + * Implements virtual machine DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 force, Context context) { + deleteAsync(resourceGroupName, virtualMachineName, force, context).block(); + } + + /** + * Stop virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .stop( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Stop virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .stop( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Stop virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 + .start( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Start virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 + .start( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Start virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> 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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart( + String resourceGroupName, String virtualMachineName, Context context) { + return beginStartAsync(resourceGroupName, virtualMachineName, context).getSyncPoller(); + } + + /** + * Start virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync(String resourceGroupName, String virtualMachineName, Context context) { + return beginStartAsync(resourceGroupName, virtualMachineName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Start virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void start(String resourceGroupName, String virtualMachineName, Context context) { + startAsync(resourceGroupName, virtualMachineName, context).block(); + } + + /** + * Restart virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 + .restart( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Restart virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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 + .restart( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualMachineName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Restart virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> 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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart( + String resourceGroupName, String virtualMachineName, Context context) { + return beginRestartAsync(resourceGroupName, virtualMachineName, context).getSyncPoller(); + } + + /** + * Restart virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono restartAsync(String resourceGroupName, String virtualMachineName, Context context) { + return beginRestartAsync(resourceGroupName, virtualMachineName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restart virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void restart(String resourceGroupName, String virtualMachineName, Context context) { + restartAsync(resourceGroupName, virtualMachineName, context).block(); + } + + /** + * 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 -> listNextSinglePageAsync(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 -> listNextSinglePageAsync(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)); + } + + /** + * List of virtualMachines in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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)); + } + + /** + * 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> 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 list of VirtualMachines along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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)); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualMachinesImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualMachinesImpl.java new file mode 100644 index 000000000000..ea076ab5a1b9 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualMachinesImpl.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.VirtualMachinesClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.VirtualMachineInner; +import com.azure.resourcemanager.connectedvmware.models.StopVirtualMachineOptions; +import com.azure.resourcemanager.connectedvmware.models.VirtualMachine; +import com.azure.resourcemanager.connectedvmware.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.connectedvmware.ConnectedVMwareManager serviceManager; + + public VirtualMachinesImpl( + VirtualMachinesClient innerClient, + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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 force) { + this.serviceClient().delete(resourceGroupName, virtualMachineName, force); + } + + public void delete(String resourceGroupName, String virtualMachineName) { + this.serviceClient().delete(resourceGroupName, virtualMachineName); + } + + public void delete(String resourceGroupName, String virtualMachineName, Boolean force, Context context) { + this.serviceClient().delete(resourceGroupName, virtualMachineName, 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 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 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 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 localForce = null; + this.delete(resourceGroupName, virtualMachineName, 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 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, force, context); + } + + private VirtualMachinesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } + + public VirtualMachineImpl define(String name) { + return new VirtualMachineImpl(name, this.manager()); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualNetworkImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualNetworkImpl.java new file mode 100644 index 000000000000..df3f20fe8501 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualNetworkImpl.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.fluent.models.VirtualNetworkInner; +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; +import com.azure.resourcemanager.connectedvmware.models.ResourcePatch; +import com.azure.resourcemanager.connectedvmware.models.ResourceStatus; +import com.azure.resourcemanager.connectedvmware.models.VirtualNetwork; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class VirtualNetworkImpl implements VirtualNetwork, VirtualNetwork.Definition, VirtualNetwork.Update { + private VirtualNetworkInner innerObject; + + private final com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String uuid() { + return this.innerModel().uuid(); + } + + public String vCenterId() { + return this.innerModel().vCenterId(); + } + + public String moRefId() { + return this.innerModel().moRefId(); + } + + public String inventoryItemId() { + return this.innerModel().inventoryItemId(); + } + + public String moName() { + return this.innerModel().moName(); + } + + public String customResourceName() { + return this.innerModel().customResourceName(); + } + + public List statuses() { + List inner = this.innerModel().statuses(); + 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 VirtualNetworkInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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() + .create(resourceGroupName, virtualNetworkName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualNetwork create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworks() + .create(resourceGroupName, virtualNetworkName, this.innerModel(), context); + return this; + } + + VirtualNetworkImpl(String name, com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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() + .updateWithResponse(resourceGroupName, virtualNetworkName, updateBody, Context.NONE) + .getValue(); + return this; + } + + public VirtualNetwork apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworks() + .updateWithResponse(resourceGroupName, virtualNetworkName, updateBody, context) + .getValue(); + return this; + } + + VirtualNetworkImpl( + VirtualNetworkInner innerObject, + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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 withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public VirtualNetworkImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public VirtualNetworkImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } + + public VirtualNetworkImpl withVCenterId(String vCenterId) { + this.innerModel().withVCenterId(vCenterId); + return this; + } + + public VirtualNetworkImpl withMoRefId(String moRefId) { + this.innerModel().withMoRefId(moRefId); + return this; + } + + public VirtualNetworkImpl withInventoryItemId(String inventoryItemId) { + this.innerModel().withInventoryItemId(inventoryItemId); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualNetworksClientImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualNetworksClientImpl.java new file mode 100644 index 000000000000..1a87b030b368 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualNetworksClientImpl.java @@ -0,0 +1,1542 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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.connectedvmware.fluent.VirtualNetworksClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.VirtualNetworkInner; +import com.azure.resourcemanager.connectedvmware.models.ResourcePatch; +import com.azure.resourcemanager.connectedvmware.models.VirtualNetworksList; +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 ConnectedVMwareClientImpl client; + + /** + * Initializes an instance of VirtualNetworksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualNetworksClientImpl(ConnectedVMwareClientImpl client) { + this.service = + RestProxy.create(VirtualNetworksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConnectedVMwareClientVirtualNetworks to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConnectedVMwareClien") + private interface VirtualNetworksService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualNetworks/{virtualNetworkName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @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"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/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"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/virtualNetworks/{virtualNetworkName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualNetworkName") String virtualNetworkName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResourcePatch body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/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"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/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( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.ConnectedVMwarevSphere/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("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create Or Update virtual network. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @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 define the virtualNetwork along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + 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) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualNetworkName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create Or Update virtual network. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @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 define the virtualNetwork along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + 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) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualNetworkName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Create Or Update virtual network. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @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 define the virtualNetwork. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualNetworkInner> beginCreateAsync( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body) { + Mono>> mono = createWithResponseAsync(resourceGroupName, virtualNetworkName, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualNetworkInner.class, + VirtualNetworkInner.class, + this.client.getContext()); + } + + /** + * Create Or Update virtual network. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @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 define the virtualNetwork. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualNetworkInner> beginCreateAsync( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, virtualNetworkName, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), VirtualNetworkInner.class, VirtualNetworkInner.class, context); + } + + /** + * Create Or Update virtual network. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @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 define the virtualNetwork. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualNetworkInner> beginCreate( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body) { + return beginCreateAsync(resourceGroupName, virtualNetworkName, body).getSyncPoller(); + } + + /** + * Create Or Update virtual network. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @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 define the virtualNetwork. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualNetworkInner> beginCreate( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body, Context context) { + return beginCreateAsync(resourceGroupName, virtualNetworkName, body, context).getSyncPoller(); + } + + /** + * Create Or Update virtual network. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @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 define the virtualNetwork on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body) { + return beginCreateAsync(resourceGroupName, virtualNetworkName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update virtual network. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualNetwork on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String virtualNetworkName) { + final VirtualNetworkInner body = null; + return beginCreateAsync(resourceGroupName, virtualNetworkName, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update virtual network. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @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 define the virtualNetwork on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body, Context context) { + return beginCreateAsync(resourceGroupName, virtualNetworkName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update virtual network. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @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 define the virtualNetwork. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkInner create(String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body) { + return createAsync(resourceGroupName, virtualNetworkName, body).block(); + } + + /** + * Create Or Update virtual network. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualNetwork. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkInner create(String resourceGroupName, String virtualNetworkName) { + final VirtualNetworkInner body = null; + return createAsync(resourceGroupName, virtualNetworkName, body).block(); + } + + /** + * Create Or Update virtual network. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @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 define the virtualNetwork. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkInner create( + String resourceGroupName, String virtualNetworkName, VirtualNetworkInner body, Context context) { + return createAsync(resourceGroupName, virtualNetworkName, body, context).block(); + } + + /** + * Implements virtual network GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualNetwork 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 virtual network GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualNetwork 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 virtual network GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualNetwork 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 virtual network GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualNetwork. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkInner getByResourceGroup(String resourceGroupName, String virtualNetworkName) { + return getByResourceGroupAsync(resourceGroupName, virtualNetworkName).block(); + } + + /** + * Implements virtual network GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualNetwork along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualNetworkName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, virtualNetworkName, context).block(); + } + + /** + * API to update certain properties of the virtual network resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param body Resource properties to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualNetwork 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualNetworkName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * API to update certain properties of the virtual network resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualNetwork 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.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) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + virtualNetworkName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * API to update certain properties of the virtual network resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param body Resource properties to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualNetwork on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String virtualNetworkName, ResourcePatch body) { + return updateWithResponseAsync(resourceGroupName, virtualNetworkName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * API to update certain properties of the virtual network resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualNetwork on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String virtualNetworkName) { + final ResourcePatch body = null; + return updateWithResponseAsync(resourceGroupName, virtualNetworkName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * API to update certain properties of the virtual network resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualNetwork. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkInner update(String resourceGroupName, String virtualNetworkName) { + final ResourcePatch body = null; + return updateAsync(resourceGroupName, virtualNetworkName, body).block(); + } + + /** + * API to update certain properties of the virtual network resource. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param body Resource properties to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualNetwork along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String virtualNetworkName, ResourcePatch body, Context context) { + return updateWithResponseAsync(resourceGroupName, virtualNetworkName, body, context).block(); + } + + /** + * Implements virtual network DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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())); + } + + /** + * Implements virtual network DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all 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); + } + + /** + * Implements virtual network DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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()); + } + + /** + * Implements virtual network DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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); + } + + /** + * Implements virtual network DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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(); + } + + /** + * Implements virtual network DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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(); + } + + /** + * Implements virtual network DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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); + } + + /** + * Implements virtual network DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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); + } + + /** + * Implements virtual network DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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); + } + + /** + * Implements virtual network DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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(); + } + + /** + * Implements virtual network DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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(); + } + + /** + * Implements virtual network DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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(); + } + + /** + * 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 -> listNextSinglePageAsync(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 -> listNextSinglePageAsync(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)); + } + + /** + * List of virtualNetworks in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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)); + } + + /** + * 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> 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 list of VirtualNetworks along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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)); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualNetworksImpl.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualNetworksImpl.java new file mode 100644 index 000000000000..07d175a9f98b --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/VirtualNetworksImpl.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.connectedvmware.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.connectedvmware.fluent.VirtualNetworksClient; +import com.azure.resourcemanager.connectedvmware.fluent.models.VirtualNetworkInner; +import com.azure.resourcemanager.connectedvmware.models.VirtualNetwork; +import com.azure.resourcemanager.connectedvmware.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.connectedvmware.ConnectedVMwareManager serviceManager; + + public VirtualNetworksImpl( + VirtualNetworksClient innerClient, + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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 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 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 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.connectedvmware.ConnectedVMwareManager manager() { + return this.serviceManager; + } + + public VirtualNetworkImpl define(String name) { + return new VirtualNetworkImpl(name, this.manager()); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/package-info.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/implementation/package-info.java new file mode 100644 index 000000000000..a12bee454054 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/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 ConnectedVMwareClient. Connected VMware Client. */ +package com.azure.resourcemanager.connectedvmware.implementation; diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Cluster.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Cluster.java new file mode 100644 index 000000000000..5417838225b9 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Cluster.java @@ -0,0 +1,349 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.fluent.models.ClusterInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Cluster. */ +public interface Cluster { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the extendedLocation property: Gets or sets the extended location. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * 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 uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + String uuid(); + + /** + * Gets the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this cluster resides. + * + * @return the vCenterId value. + */ + String vCenterId(); + + /** + * Gets the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the cluster. + * + * @return the moRefId value. + */ + String moRefId(); + + /** + * Gets the inventoryItemId property: Gets or sets the inventory Item ID for the cluster. + * + * @return the inventoryItemId value. + */ + String inventoryItemId(); + + /** + * Gets the moName property: Gets or sets the vCenter Managed Object name for the cluster. + * + * @return the moName value. + */ + String moName(); + + /** + * Gets the statuses property: The resource status information. + * + * @return the statuses value. + */ + List statuses(); + + /** + * Gets the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + String customResourceName(); + + /** + * Gets the datastoreIds property: Gets or sets the datastore ARM ids. + * + * @return the datastoreIds value. + */ + List datastoreIds(); + + /** + * Gets the networkIds property: Gets or sets the network ARM ids. + * + * @return the networkIds value. + */ + List networkIds(); + + /** + * 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.connectedvmware.fluent.models.ClusterInner object. + * + * @return the inner object. + */ + ClusterInner innerModel(); + + /** The entirety of the Cluster definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Cluster definition stages. */ + interface DefinitionStages { + /** The first stage of the Cluster definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Cluster 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 Cluster definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The Resource Group Name. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the Cluster 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.WithKind, + DefinitionStages.WithVCenterId, + DefinitionStages.WithMoRefId, + DefinitionStages.WithInventoryItemId { + /** + * Executes the create request. + * + * @return the created resource. + */ + Cluster create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Cluster create(Context context); + } + /** The stage of the Cluster 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 Cluster definition allowing to specify extendedLocation. */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: Gets or sets the extended location.. + * + * @param extendedLocation Gets or sets the extended location. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + /** The stage of the Cluster 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); + } + /** The stage of the Cluster definition allowing to specify vCenterId. */ + interface WithVCenterId { + /** + * Specifies the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this cluster + * resides.. + * + * @param vCenterId Gets or sets the ARM Id of the vCenter resource in which this cluster resides. + * @return the next definition stage. + */ + WithCreate withVCenterId(String vCenterId); + } + /** The stage of the Cluster definition allowing to specify moRefId. */ + interface WithMoRefId { + /** + * Specifies the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the + * cluster.. + * + * @param moRefId Gets or sets the vCenter MoRef (Managed Object Reference) ID for the cluster. + * @return the next definition stage. + */ + WithCreate withMoRefId(String moRefId); + } + /** The stage of the Cluster definition allowing to specify inventoryItemId. */ + interface WithInventoryItemId { + /** + * Specifies the inventoryItemId property: Gets or sets the inventory Item ID for the cluster.. + * + * @param inventoryItemId Gets or sets the inventory Item ID for the cluster. + * @return the next definition stage. + */ + WithCreate withInventoryItemId(String inventoryItemId); + } + } + /** + * Begins update for the Cluster resource. + * + * @return the stage of resource update. + */ + Cluster.Update update(); + + /** The template for Cluster update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Cluster apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Cluster apply(Context context); + } + /** The Cluster update stages. */ + interface UpdateStages { + /** The stage of the Cluster 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. + */ + Cluster refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Cluster refresh(Context context); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ClusterInventoryItem.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ClusterInventoryItem.java new file mode 100644 index 000000000000..afb54a823f20 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ClusterInventoryItem.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.fluent.models.InventoryItemProperties; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The cluster inventory item. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "inventoryType") +@JsonTypeName("Cluster") +@Fluent +public final class ClusterInventoryItem extends InventoryItemProperties { + /** {@inheritDoc} */ + @Override + public ClusterInventoryItem withManagedResourceId(String managedResourceId) { + super.withManagedResourceId(managedResourceId); + return this; + } + + /** {@inheritDoc} */ + @Override + public ClusterInventoryItem withMoRefId(String moRefId) { + super.withMoRefId(moRefId); + return this; + } + + /** {@inheritDoc} */ + @Override + public ClusterInventoryItem withMoName(String moName) { + super.withMoName(moName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Clusters.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Clusters.java new file mode 100644 index 000000000000..397e29602cd2 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Clusters.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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 Clusters. */ +public interface Clusters { + /** + * Implements cluster GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the cluster. + */ + Cluster getByResourceGroup(String resourceGroupName, String clusterName); + + /** + * Implements cluster GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the cluster along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String clusterName, Context context); + + /** + * Implements cluster DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName, Boolean force); + + /** + * Implements cluster DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName); + + /** + * Implements cluster DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param clusterName Name of the cluster. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 clusterName, Boolean force, Context context); + + /** + * List of clusters 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 Clusters as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List of clusters 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 Clusters as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List of clusters in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Clusters as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of clusters in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Clusters as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Implements cluster 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 define the cluster along with {@link Response}. + */ + Cluster getById(String id); + + /** + * Implements cluster 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 define the cluster along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Implements cluster DELETE 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. + */ + void deleteById(String id); + + /** + * Implements cluster DELETE method. + * + * @param id the resource ID. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 Cluster resource. + * + * @param name resource name. + * @return the first stage of the new Cluster definition. + */ + Cluster.DefinitionStages.Blank define(String name); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ClustersList.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ClustersList.java new file mode 100644 index 000000000000..700d7025a85e --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ClustersList.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.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.connectedvmware.fluent.models.ClusterInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of Clusters. */ +@Fluent +public final class ClustersList { + /* + * Url to follow for getting next page of Clusters. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * Array of Clusters + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the nextLink property: Url to follow for getting next page of Clusters. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to follow for getting next page of Clusters. + * + * @param nextLink the nextLink value to set. + * @return the ClustersList object itself. + */ + public ClustersList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: Array of Clusters. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of Clusters. + * + * @param value the value value to set. + * @return the ClustersList object itself. + */ + public ClustersList 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 ClustersList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ClustersList.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Datastore.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Datastore.java new file mode 100644 index 000000000000..0738720a6520 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Datastore.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.fluent.models.DatastoreInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Datastore. */ +public interface Datastore { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the extendedLocation property: Gets or sets the extended location. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * 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 uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + String uuid(); + + /** + * Gets the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this datastore resides. + * + * @return the vCenterId value. + */ + String vCenterId(); + + /** + * Gets the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the datastore. + * + * @return the moRefId value. + */ + String moRefId(); + + /** + * Gets the inventoryItemId property: Gets or sets the inventory Item ID for the datastore. + * + * @return the inventoryItemId value. + */ + String inventoryItemId(); + + /** + * Gets the moName property: Gets or sets the vCenter Managed Object name for the datastore. + * + * @return the moName value. + */ + String moName(); + + /** + * Gets the statuses property: The resource status information. + * + * @return the statuses value. + */ + List statuses(); + + /** + * Gets the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + String customResourceName(); + + /** + * Gets the provisioningState property: Provisioning state of the resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.connectedvmware.fluent.models.DatastoreInner object. + * + * @return the inner object. + */ + DatastoreInner innerModel(); + + /** The entirety of the Datastore definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Datastore definition stages. */ + interface DefinitionStages { + /** The first stage of the Datastore definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Datastore 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 Datastore definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The Resource Group Name. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the Datastore 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.WithKind, + DefinitionStages.WithVCenterId, + DefinitionStages.WithMoRefId, + DefinitionStages.WithInventoryItemId { + /** + * Executes the create request. + * + * @return the created resource. + */ + Datastore create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Datastore create(Context context); + } + /** The stage of the Datastore 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 Datastore definition allowing to specify extendedLocation. */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: Gets or sets the extended location.. + * + * @param extendedLocation Gets or sets the extended location. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + /** The stage of the Datastore 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); + } + /** The stage of the Datastore definition allowing to specify vCenterId. */ + interface WithVCenterId { + /** + * Specifies the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this datastore + * resides.. + * + * @param vCenterId Gets or sets the ARM Id of the vCenter resource in which this datastore resides. + * @return the next definition stage. + */ + WithCreate withVCenterId(String vCenterId); + } + /** The stage of the Datastore definition allowing to specify moRefId. */ + interface WithMoRefId { + /** + * Specifies the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the + * datastore.. + * + * @param moRefId Gets or sets the vCenter MoRef (Managed Object Reference) ID for the datastore. + * @return the next definition stage. + */ + WithCreate withMoRefId(String moRefId); + } + /** The stage of the Datastore definition allowing to specify inventoryItemId. */ + interface WithInventoryItemId { + /** + * Specifies the inventoryItemId property: Gets or sets the inventory Item ID for the datastore.. + * + * @param inventoryItemId Gets or sets the inventory Item ID for the datastore. + * @return the next definition stage. + */ + WithCreate withInventoryItemId(String inventoryItemId); + } + } + /** + * Begins update for the Datastore resource. + * + * @return the stage of resource update. + */ + Datastore.Update update(); + + /** The template for Datastore update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Datastore apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Datastore apply(Context context); + } + /** The Datastore update stages. */ + interface UpdateStages { + /** The stage of the Datastore 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. + */ + Datastore refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Datastore refresh(Context context); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/DatastoreInventoryItem.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/DatastoreInventoryItem.java new file mode 100644 index 000000000000..a83f7ad0acde --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/DatastoreInventoryItem.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.fluent.models.InventoryItemProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The datastore inventory item. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "inventoryType") +@JsonTypeName("Datastore") +@Fluent +public final class DatastoreInventoryItem extends InventoryItemProperties { + /* + * Gets or sets Maximum capacity of this datastore, in GBs. + */ + @JsonProperty(value = "capacityGB") + private Long capacityGB; + + /* + * Gets or sets Available space of this datastore, in GBs. + */ + @JsonProperty(value = "freeSpaceGB") + private Long freeSpaceGB; + + /** + * Get the capacityGB property: Gets or sets Maximum capacity of this datastore, in GBs. + * + * @return the capacityGB value. + */ + public Long capacityGB() { + return this.capacityGB; + } + + /** + * Set the capacityGB property: Gets or sets Maximum capacity of this datastore, in GBs. + * + * @param capacityGB the capacityGB value to set. + * @return the DatastoreInventoryItem object itself. + */ + public DatastoreInventoryItem withCapacityGB(Long capacityGB) { + this.capacityGB = capacityGB; + return this; + } + + /** + * Get the freeSpaceGB property: Gets or sets Available space of this datastore, in GBs. + * + * @return the freeSpaceGB value. + */ + public Long freeSpaceGB() { + return this.freeSpaceGB; + } + + /** + * Set the freeSpaceGB property: Gets or sets Available space of this datastore, in GBs. + * + * @param freeSpaceGB the freeSpaceGB value to set. + * @return the DatastoreInventoryItem object itself. + */ + public DatastoreInventoryItem withFreeSpaceGB(Long freeSpaceGB) { + this.freeSpaceGB = freeSpaceGB; + return this; + } + + /** {@inheritDoc} */ + @Override + public DatastoreInventoryItem withManagedResourceId(String managedResourceId) { + super.withManagedResourceId(managedResourceId); + return this; + } + + /** {@inheritDoc} */ + @Override + public DatastoreInventoryItem withMoRefId(String moRefId) { + super.withMoRefId(moRefId); + return this; + } + + /** {@inheritDoc} */ + @Override + public DatastoreInventoryItem withMoName(String moName) { + super.withMoName(moName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Datastores.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Datastores.java new file mode 100644 index 000000000000..1b66c37a8b8c --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Datastores.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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 Datastores. */ +public interface Datastores { + /** + * Implements datastore GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the datastore. + */ + Datastore getByResourceGroup(String resourceGroupName, String datastoreName); + + /** + * Implements datastore GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the datastore along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String datastoreName, Context context); + + /** + * Implements datastore DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 datastoreName, Boolean force); + + /** + * Implements datastore DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 datastoreName); + + /** + * Implements datastore DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param datastoreName Name of the datastore. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 datastoreName, Boolean force, Context context); + + /** + * List of datastores 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 Datastores as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List of datastores 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 Datastores as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List of datastores in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Datastores as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of datastores in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Datastores as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Implements datastore 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 define the datastore along with {@link Response}. + */ + Datastore getById(String id); + + /** + * Implements datastore 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 define the datastore along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Implements datastore DELETE 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. + */ + void deleteById(String id); + + /** + * Implements datastore DELETE method. + * + * @param id the resource ID. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 Datastore resource. + * + * @param name resource name. + * @return the first stage of the new Datastore definition. + */ + Datastore.DefinitionStages.Blank define(String name); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/DatastoresList.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/DatastoresList.java new file mode 100644 index 000000000000..4d6a3f7a07ee --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/DatastoresList.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.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.connectedvmware.fluent.models.DatastoreInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of Datastores. */ +@Fluent +public final class DatastoresList { + /* + * Url to follow for getting next page of Datastores. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * Array of Datastores + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the nextLink property: Url to follow for getting next page of Datastores. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to follow for getting next page of Datastores. + * + * @param nextLink the nextLink value to set. + * @return the DatastoresList object itself. + */ + public DatastoresList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: Array of Datastores. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of Datastores. + * + * @param value the value value to set. + * @return the DatastoresList object itself. + */ + public DatastoresList 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 DatastoresList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DatastoresList.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/DiskMode.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/DiskMode.java new file mode 100644 index 000000000000..34aa65e47797 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/DiskMode.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.connectedvmware.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DiskMode. */ +public final class DiskMode extends ExpandableStringEnum { + /** Static value persistent for DiskMode. */ + public static final DiskMode PERSISTENT = fromString("persistent"); + + /** Static value independent_persistent for DiskMode. */ + public static final DiskMode INDEPENDENT_PERSISTENT = fromString("independent_persistent"); + + /** Static value independent_nonpersistent for DiskMode. */ + public static final DiskMode INDEPENDENT_NONPERSISTENT = fromString("independent_nonpersistent"); + + /** + * Creates or finds a DiskMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiskMode. + */ + @JsonCreator + public static DiskMode fromString(String name) { + return fromString(name, DiskMode.class); + } + + /** + * Gets known DiskMode values. + * + * @return known DiskMode values. + */ + public static Collection values() { + return values(DiskMode.class); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/DiskType.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/DiskType.java new file mode 100644 index 000000000000..a06ccfed2529 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/DiskType.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.connectedvmware.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DiskType. */ +public final class DiskType extends ExpandableStringEnum { + /** Static value flat for DiskType. */ + public static final DiskType FLAT = fromString("flat"); + + /** Static value pmem for DiskType. */ + public static final DiskType PMEM = fromString("pmem"); + + /** Static value rawphysical for DiskType. */ + public static final DiskType RAWPHYSICAL = fromString("rawphysical"); + + /** Static value rawvirtual for DiskType. */ + public static final DiskType RAWVIRTUAL = fromString("rawvirtual"); + + /** Static value sparse for DiskType. */ + public static final DiskType SPARSE = fromString("sparse"); + + /** Static value sesparse for DiskType. */ + public static final DiskType SESPARSE = fromString("sesparse"); + + /** Static value unknown for DiskType. */ + public static final DiskType UNKNOWN = fromString("unknown"); + + /** + * Creates or finds a DiskType from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiskType. + */ + @JsonCreator + public static DiskType fromString(String name) { + return fromString(name, DiskType.class); + } + + /** + * Gets known DiskType values. + * + * @return known DiskType values. + */ + public static Collection values() { + return values(DiskType.class); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ErrorDetail.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ErrorDetail.java new file mode 100644 index 000000000000..88d4043ff940 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ErrorDetail.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Error details. */ +@Fluent +public final class ErrorDetail { + /* + * The error's code. + */ + @JsonProperty(value = "code", required = true) + private String code; + + /* + * A human readable error message. + */ + @JsonProperty(value = "message", required = true) + private String message; + + /* + * Indicates which property in the request is responsible for the error. + */ + @JsonProperty(value = "target") + private String target; + + /* + * Additional error details. + */ + @JsonProperty(value = "details") + private List details; + + /** + * Get the code property: The error's code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: The error's code. + * + * @param code the code value to set. + * @return the ErrorDetail object itself. + */ + public ErrorDetail withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: A human readable error message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: A human readable error message. + * + * @param message the message value to set. + * @return the ErrorDetail object itself. + */ + public ErrorDetail withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the target property: Indicates which property in the request is responsible for the error. + * + * @return the target value. + */ + public String target() { + return this.target; + } + + /** + * Set the target property: Indicates which property in the request is responsible for the error. + * + * @param target the target value to set. + * @return the ErrorDetail object itself. + */ + public ErrorDetail withTarget(String target) { + this.target = target; + return this; + } + + /** + * Get the details property: Additional error details. + * + * @return the details value. + */ + public List details() { + return this.details; + } + + /** + * Set the details property: Additional error details. + * + * @param details the details value to set. + * @return the ErrorDetail object itself. + */ + public ErrorDetail withDetails(List details) { + this.details = details; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (code() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property code in model ErrorDetail")); + } + if (message() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property message in model ErrorDetail")); + } + if (details() != null) { + details().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ErrorDetail.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ExtendedLocation.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ExtendedLocation.java new file mode 100644 index 000000000000..593aadf3123f --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/FirmwareType.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/FirmwareType.java new file mode 100644 index 000000000000..b9fc96061c01 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/FirmwareType.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.connectedvmware.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for FirmwareType. */ +public final class FirmwareType extends ExpandableStringEnum { + /** Static value bios for FirmwareType. */ + public static final FirmwareType BIOS = fromString("bios"); + + /** Static value efi for FirmwareType. */ + public static final FirmwareType EFI = fromString("efi"); + + /** + * Creates or finds a FirmwareType from its string representation. + * + * @param name a name to look for. + * @return the corresponding FirmwareType. + */ + @JsonCreator + public static FirmwareType fromString(String name) { + return fromString(name, FirmwareType.class); + } + + /** + * Gets known FirmwareType values. + * + * @return known FirmwareType values. + */ + public static Collection values() { + return values(FirmwareType.class); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/GuestAgent.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/GuestAgent.java new file mode 100644 index 000000000000..0827615cca34 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/GuestAgent.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.fluent.models.GuestAgentInner; +import java.util.List; + +/** An immutable client-side representation of GuestAgent. */ +public interface GuestAgent { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: The system data. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + String uuid(); + + /** + * Gets the credentials property: Username / Password Credentials to provision guest agent. + * + * @return the credentials value. + */ + GuestCredential credentials(); + + /** + * Gets the httpProxyConfig property: HTTP Proxy configuration for the VM. + * + * @return the httpProxyConfig value. + */ + HttpProxyConfiguration httpProxyConfig(); + + /** + * Gets the provisioningAction property: Gets or sets the guest agent provisioning action. + * + * @return the provisioningAction value. + */ + ProvisioningAction provisioningAction(); + + /** + * Gets the status property: Gets or sets the guest agent status. + * + * @return the status value. + */ + String status(); + + /** + * Gets the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + String customResourceName(); + + /** + * Gets the statuses property: The resource status information. + * + * @return the statuses value. + */ + List statuses(); + + /** + * Gets the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.connectedvmware.fluent.models.GuestAgentInner object. + * + * @return the inner object. + */ + GuestAgentInner innerModel(); + + /** The entirety of the GuestAgent definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The GuestAgent definition stages. */ + interface DefinitionStages { + /** The first stage of the GuestAgent definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the GuestAgent definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, virtualMachineName. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @return the next definition stage. + */ + WithCreate withExistingVirtualMachine(String resourceGroupName, String virtualMachineName); + } + /** + * The stage of the GuestAgent 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.WithCredentials, + DefinitionStages.WithHttpProxyConfig, + DefinitionStages.WithProvisioningAction { + /** + * Executes the create request. + * + * @return the created resource. + */ + GuestAgent create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + GuestAgent create(Context context); + } + /** The stage of the GuestAgent definition allowing to specify credentials. */ + interface WithCredentials { + /** + * Specifies the credentials property: Username / Password Credentials to provision guest agent.. + * + * @param credentials Username / Password Credentials to provision guest agent. + * @return the next definition stage. + */ + WithCreate withCredentials(GuestCredential credentials); + } + /** The stage of the GuestAgent definition allowing to specify httpProxyConfig. */ + interface WithHttpProxyConfig { + /** + * Specifies the httpProxyConfig property: HTTP Proxy configuration for the VM.. + * + * @param httpProxyConfig HTTP Proxy configuration for the VM. + * @return the next definition stage. + */ + WithCreate withHttpProxyConfig(HttpProxyConfiguration httpProxyConfig); + } + /** The stage of the GuestAgent definition allowing to specify provisioningAction. */ + interface WithProvisioningAction { + /** + * Specifies the provisioningAction property: Gets or sets the guest agent provisioning action.. + * + * @param provisioningAction Gets or sets the guest agent provisioning action. + * @return the next definition stage. + */ + WithCreate withProvisioningAction(ProvisioningAction provisioningAction); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + GuestAgent refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + GuestAgent refresh(Context context); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/GuestAgentList.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/GuestAgentList.java new file mode 100644 index 000000000000..4b4c1fc0f131 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/GuestAgentList.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.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.connectedvmware.fluent.models.GuestAgentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of GuestAgent. */ +@Fluent +public final class GuestAgentList { + /* + * Url to follow for getting next page of GuestAgent. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * Array of GuestAgent + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the nextLink property: Url to follow for getting next page of GuestAgent. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to follow for getting next page of GuestAgent. + * + * @param nextLink the nextLink value to set. + * @return the GuestAgentList object itself. + */ + public GuestAgentList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: Array of GuestAgent. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of GuestAgent. + * + * @param value the value value to set. + * @return the GuestAgentList object itself. + */ + public GuestAgentList 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 GuestAgentList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GuestAgentList.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/GuestAgentProfile.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/GuestAgentProfile.java new file mode 100644 index 000000000000..a32f2b280fec --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/GuestAgentProfile.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Defines the resource properties. */ +@Immutable +public final class GuestAgentProfile { + /* + * Specifies the VM's unique SMBIOS ID. + */ + @JsonProperty(value = "vmUuid", access = JsonProperty.Access.WRITE_ONLY) + private String vmUuid; + + /* + * The status of the hybrid machine agent. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private StatusTypes status; + + /* + * The time of the last status change. + */ + @JsonProperty(value = "lastStatusChange", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastStatusChange; + + /* + * The hybrid machine agent full version. + */ + @JsonProperty(value = "agentVersion", access = JsonProperty.Access.WRITE_ONLY) + private String agentVersion; + + /* + * Details about the error state. + */ + @JsonProperty(value = "errorDetails", access = JsonProperty.Access.WRITE_ONLY) + private List errorDetails; + + /** + * Get the vmUuid property: Specifies the VM's unique SMBIOS ID. + * + * @return the vmUuid value. + */ + public String vmUuid() { + return this.vmUuid; + } + + /** + * Get the status property: The status of the hybrid machine agent. + * + * @return the status value. + */ + public StatusTypes status() { + return this.status; + } + + /** + * Get the lastStatusChange property: The time of the last status change. + * + * @return the lastStatusChange value. + */ + public OffsetDateTime lastStatusChange() { + return this.lastStatusChange; + } + + /** + * Get the agentVersion property: The hybrid machine agent full version. + * + * @return the agentVersion value. + */ + public String agentVersion() { + return this.agentVersion; + } + + /** + * Get the errorDetails property: Details about the error state. + * + * @return the errorDetails value. + */ + public List errorDetails() { + return this.errorDetails; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (errorDetails() != null) { + errorDetails().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/GuestAgents.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/GuestAgents.java new file mode 100644 index 000000000000..4cdae5e535a4 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/GuestAgents.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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 GuestAgents. */ +public interface GuestAgents { + /** + * Implements GuestAgent GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the GuestAgent. + */ + GuestAgent get(String resourceGroupName, String virtualMachineName, String name); + + /** + * Implements GuestAgent GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the GuestAgent along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String virtualMachineName, String name, Context context); + + /** + * Implements GuestAgent DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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, String name); + + /** + * Implements GuestAgent DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param name Name of the GuestAgent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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, String name, Context context); + + /** + * Returns the list of GuestAgent of the given vm. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 GuestAgent as paginated response with {@link PagedIterable}. + */ + PagedIterable listByVm(String resourceGroupName, String virtualMachineName); + + /** + * Returns the list of GuestAgent of the given vm. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 GuestAgent as paginated response with {@link PagedIterable}. + */ + PagedIterable listByVm(String resourceGroupName, String virtualMachineName, Context context); + + /** + * Implements GuestAgent 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 defines the GuestAgent along with {@link Response}. + */ + GuestAgent getById(String id); + + /** + * Implements GuestAgent 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 defines the GuestAgent along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Implements GuestAgent DELETE 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. + */ + void deleteById(String id); + + /** + * Implements GuestAgent DELETE 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. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new GuestAgent resource. + * + * @param name resource name. + * @return the first stage of the new GuestAgent definition. + */ + GuestAgent.DefinitionStages.Blank define(String name); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/GuestCredential.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/GuestCredential.java new file mode 100644 index 000000000000..6507733d970c --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/GuestCredential.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.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Username / Password Credentials to connect to guest. */ +@Fluent +public final class GuestCredential { + /* + * Gets or sets username to connect with the guest. + */ + @JsonProperty(value = "username") + private String username; + + /* + * Gets or sets the password to connect with the guest. + */ + @JsonProperty(value = "password") + private String password; + + /** + * Get the username property: Gets or sets username to connect with the guest. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: Gets or sets username to connect with the guest. + * + * @param username the username value to set. + * @return the GuestCredential object itself. + */ + public GuestCredential withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: Gets or sets the password to connect with the guest. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: Gets or sets the password to connect with the guest. + * + * @param password the password value to set. + * @return the GuestCredential object itself. + */ + public GuestCredential withPassword(String password) { + this.password = password; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HardwareProfile.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HardwareProfile.java new file mode 100644 index 000000000000..165f800403a9 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HardwareProfile.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the resource properties. */ +@Fluent +public final class HardwareProfile { + /* + * Gets or sets memory size in MBs for the vm. + */ + @JsonProperty(value = "memorySizeMB") + private Integer memorySizeMB; + + /* + * Gets or sets the number of vCPUs for the vm. + */ + @JsonProperty(value = "numCPUs") + private Integer numCPUs; + + /* + * Gets or sets the number of cores per socket for the vm. Defaults to 1 if + * unspecified. + */ + @JsonProperty(value = "numCoresPerSocket") + private Integer numCoresPerSocket; + + /* + * Gets or sets a value indicating whether virtual processors can be added + * while this virtual machine is running. + */ + @JsonProperty(value = "cpuHotAddEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean cpuHotAddEnabled; + + /* + * Gets or sets a value indicating whether virtual processors can be + * removed while this virtual machine is running. + */ + @JsonProperty(value = "cpuHotRemoveEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean cpuHotRemoveEnabled; + + /* + * Gets or sets a value indicating whether memory can be added while this + * virtual machine is running. + */ + @JsonProperty(value = "memoryHotAddEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean memoryHotAddEnabled; + + /** + * Get the memorySizeMB property: Gets or sets memory size in MBs for the vm. + * + * @return the memorySizeMB value. + */ + public Integer memorySizeMB() { + return this.memorySizeMB; + } + + /** + * Set the memorySizeMB property: Gets or sets memory size in MBs for the vm. + * + * @param memorySizeMB the memorySizeMB value to set. + * @return the HardwareProfile object itself. + */ + public HardwareProfile withMemorySizeMB(Integer memorySizeMB) { + this.memorySizeMB = memorySizeMB; + return this; + } + + /** + * Get the numCPUs property: Gets or sets the number of vCPUs for the vm. + * + * @return the numCPUs value. + */ + public Integer numCPUs() { + return this.numCPUs; + } + + /** + * Set the numCPUs property: Gets or sets the number of vCPUs for the vm. + * + * @param numCPUs the numCPUs value to set. + * @return the HardwareProfile object itself. + */ + public HardwareProfile withNumCPUs(Integer numCPUs) { + this.numCPUs = numCPUs; + return this; + } + + /** + * Get the numCoresPerSocket property: Gets or sets the number of cores per socket for the vm. Defaults to 1 if + * unspecified. + * + * @return the numCoresPerSocket value. + */ + public Integer numCoresPerSocket() { + return this.numCoresPerSocket; + } + + /** + * Set the numCoresPerSocket property: Gets or sets the number of cores per socket for the vm. Defaults to 1 if + * unspecified. + * + * @param numCoresPerSocket the numCoresPerSocket value to set. + * @return the HardwareProfile object itself. + */ + public HardwareProfile withNumCoresPerSocket(Integer numCoresPerSocket) { + this.numCoresPerSocket = numCoresPerSocket; + return this; + } + + /** + * Get the cpuHotAddEnabled property: Gets or sets a value indicating whether virtual processors can be added while + * this virtual machine is running. + * + * @return the cpuHotAddEnabled value. + */ + public Boolean cpuHotAddEnabled() { + return this.cpuHotAddEnabled; + } + + /** + * Get the cpuHotRemoveEnabled property: Gets or sets a value indicating whether virtual processors can be removed + * while this virtual machine is running. + * + * @return the cpuHotRemoveEnabled value. + */ + public Boolean cpuHotRemoveEnabled() { + return this.cpuHotRemoveEnabled; + } + + /** + * Get the memoryHotAddEnabled property: Gets or sets a value indicating whether memory can be added while this + * virtual machine is running. + * + * @return the memoryHotAddEnabled value. + */ + public Boolean memoryHotAddEnabled() { + return this.memoryHotAddEnabled; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HostInventoryItem.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HostInventoryItem.java new file mode 100644 index 000000000000..afedda519a3f --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HostInventoryItem.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.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.fluent.models.InventoryItemProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The host inventory item. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "inventoryType") +@JsonTypeName("Host") +@Fluent +public final class HostInventoryItem extends InventoryItemProperties { + /* + * Parent host inventory resource details. + */ + @JsonProperty(value = "parent") + private InventoryItemDetails parent; + + /** + * Get the parent property: Parent host inventory resource details. + * + * @return the parent value. + */ + public InventoryItemDetails parent() { + return this.parent; + } + + /** + * Set the parent property: Parent host inventory resource details. + * + * @param parent the parent value to set. + * @return the HostInventoryItem object itself. + */ + public HostInventoryItem withParent(InventoryItemDetails parent) { + this.parent = parent; + return this; + } + + /** {@inheritDoc} */ + @Override + public HostInventoryItem withManagedResourceId(String managedResourceId) { + super.withManagedResourceId(managedResourceId); + return this; + } + + /** {@inheritDoc} */ + @Override + public HostInventoryItem withMoRefId(String moRefId) { + super.withMoRefId(moRefId); + return this; + } + + /** {@inheritDoc} */ + @Override + public HostInventoryItem withMoName(String moName) { + super.withMoName(moName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (parent() != null) { + parent().validate(); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HostModel.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HostModel.java new file mode 100644 index 000000000000..97c2342d44ad --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HostModel.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.fluent.models.HostModelInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of HostModel. */ +public interface HostModel { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the extendedLocation property: Gets or sets the extended location. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * 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 uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + String uuid(); + + /** + * Gets the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this host resides. + * + * @return the vCenterId value. + */ + String vCenterId(); + + /** + * Gets the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the host. + * + * @return the moRefId value. + */ + String moRefId(); + + /** + * Gets the inventoryItemId property: Gets or sets the inventory Item ID for the host. + * + * @return the inventoryItemId value. + */ + String inventoryItemId(); + + /** + * Gets the moName property: Gets or sets the vCenter Managed Object name for the host. + * + * @return the moName value. + */ + String moName(); + + /** + * Gets the statuses property: The resource status information. + * + * @return the statuses value. + */ + List statuses(); + + /** + * Gets the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + String customResourceName(); + + /** + * 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.connectedvmware.fluent.models.HostModelInner object. + * + * @return the inner object. + */ + HostModelInner innerModel(); + + /** The entirety of the HostModel definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The HostModel definition stages. */ + interface DefinitionStages { + /** The first stage of the HostModel definition. */ + interface Blank extends WithLocation { + } + /** The stage of the HostModel 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 HostModel definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The Resource Group Name. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the HostModel 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.WithKind, + DefinitionStages.WithVCenterId, + DefinitionStages.WithMoRefId, + DefinitionStages.WithInventoryItemId { + /** + * Executes the create request. + * + * @return the created resource. + */ + HostModel create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + HostModel create(Context context); + } + /** The stage of the HostModel 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 HostModel definition allowing to specify extendedLocation. */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: Gets or sets the extended location.. + * + * @param extendedLocation Gets or sets the extended location. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + /** The stage of the HostModel 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); + } + /** The stage of the HostModel definition allowing to specify vCenterId. */ + interface WithVCenterId { + /** + * Specifies the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this host + * resides.. + * + * @param vCenterId Gets or sets the ARM Id of the vCenter resource in which this host resides. + * @return the next definition stage. + */ + WithCreate withVCenterId(String vCenterId); + } + /** The stage of the HostModel definition allowing to specify moRefId. */ + interface WithMoRefId { + /** + * Specifies the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the + * host.. + * + * @param moRefId Gets or sets the vCenter MoRef (Managed Object Reference) ID for the host. + * @return the next definition stage. + */ + WithCreate withMoRefId(String moRefId); + } + /** The stage of the HostModel definition allowing to specify inventoryItemId. */ + interface WithInventoryItemId { + /** + * Specifies the inventoryItemId property: Gets or sets the inventory Item ID for the host.. + * + * @param inventoryItemId Gets or sets the inventory Item ID for the host. + * @return the next definition stage. + */ + WithCreate withInventoryItemId(String inventoryItemId); + } + } + /** + * Begins update for the HostModel resource. + * + * @return the stage of resource update. + */ + HostModel.Update update(); + + /** The template for HostModel update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + HostModel apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + HostModel apply(Context context); + } + /** The HostModel update stages. */ + interface UpdateStages { + /** The stage of the HostModel 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. + */ + HostModel refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + HostModel refresh(Context context); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Hosts.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Hosts.java new file mode 100644 index 000000000000..ec3aad333f7e --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Hosts.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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 Hosts. */ +public interface Hosts { + /** + * Implements host GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the host. + */ + HostModel getByResourceGroup(String resourceGroupName, String hostname); + + /** + * Implements host GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the host along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String hostname, Context context); + + /** + * Implements host DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 hostname, Boolean force); + + /** + * Implements host DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 hostname); + + /** + * Implements host DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param hostname Name of the host. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 hostname, Boolean force, Context context); + + /** + * List of hosts 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 Hosts as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List of hosts 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 Hosts as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List of hosts in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Hosts as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of hosts in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Hosts as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Implements host 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 define the host along with {@link Response}. + */ + HostModel getById(String id); + + /** + * Implements host 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 define the host along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Implements host DELETE 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. + */ + void deleteById(String id); + + /** + * Implements host DELETE method. + * + * @param id the resource ID. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 HostModel resource. + * + * @param name resource name. + * @return the first stage of the new HostModel definition. + */ + HostModel.DefinitionStages.Blank define(String name); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HostsList.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HostsList.java new file mode 100644 index 000000000000..52d8318b133f --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HostsList.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.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.connectedvmware.fluent.models.HostModelInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of Hosts. */ +@Fluent +public final class HostsList { + /* + * Url to follow for getting next page of Hosts. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * Array of Hosts + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the nextLink property: Url to follow for getting next page of Hosts. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to follow for getting next page of Hosts. + * + * @param nextLink the nextLink value to set. + * @return the HostsList object itself. + */ + public HostsList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: Array of Hosts. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of Hosts. + * + * @param value the value value to set. + * @return the HostsList object itself. + */ + public HostsList 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 HostsList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HostsList.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HttpProxyConfiguration.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HttpProxyConfiguration.java new file mode 100644 index 000000000000..e164ffecece0 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HttpProxyConfiguration.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.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** HTTP Proxy configuration for the VM. */ +@Fluent +public final class HttpProxyConfiguration { + /* + * Gets or sets httpsProxy url. + */ + @JsonProperty(value = "httpsProxy") + private String httpsProxy; + + /** + * Get the httpsProxy property: Gets or sets httpsProxy url. + * + * @return the httpsProxy value. + */ + public String httpsProxy() { + return this.httpsProxy; + } + + /** + * Set the httpsProxy property: Gets or sets httpsProxy url. + * + * @param httpsProxy the httpsProxy value to set. + * @return the HttpProxyConfiguration object itself. + */ + public HttpProxyConfiguration withHttpsProxy(String httpsProxy) { + this.httpsProxy = httpsProxy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HybridIdentityMetadata.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HybridIdentityMetadata.java new file mode 100644 index 000000000000..81becfe935f1 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HybridIdentityMetadata.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.fluent.models.HybridIdentityMetadataInner; + +/** An immutable client-side representation of HybridIdentityMetadata. */ +public interface HybridIdentityMetadata { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: The system data. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the vmId property: Gets or sets the Vm Id. + * + * @return the vmId value. + */ + String vmId(); + + /** + * Gets the publicKey property: Gets or sets the Public Key. + * + * @return the publicKey value. + */ + String publicKey(); + + /** + * Gets the identity property: The identity of the resource. + * + * @return the identity value. + */ + Identity identity(); + + /** + * Gets the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.connectedvmware.fluent.models.HybridIdentityMetadataInner object. + * + * @return the inner object. + */ + HybridIdentityMetadataInner innerModel(); + + /** The entirety of the HybridIdentityMetadata definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The HybridIdentityMetadata definition stages. */ + interface DefinitionStages { + /** The first stage of the HybridIdentityMetadata definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the HybridIdentityMetadata definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, virtualMachineName. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @return the next definition stage. + */ + WithCreate withExistingVirtualMachine(String resourceGroupName, String virtualMachineName); + } + /** + * The stage of the HybridIdentityMetadata 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.WithVmId, DefinitionStages.WithPublicKey { + /** + * Executes the create request. + * + * @return the created resource. + */ + HybridIdentityMetadata create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + HybridIdentityMetadata create(Context context); + } + /** The stage of the HybridIdentityMetadata definition allowing to specify vmId. */ + interface WithVmId { + /** + * Specifies the vmId property: Gets or sets the Vm Id.. + * + * @param vmId Gets or sets the Vm Id. + * @return the next definition stage. + */ + WithCreate withVmId(String vmId); + } + /** The stage of the HybridIdentityMetadata definition allowing to specify publicKey. */ + interface WithPublicKey { + /** + * Specifies the publicKey property: Gets or sets the Public Key.. + * + * @param publicKey Gets or sets the Public Key. + * @return the next definition stage. + */ + WithCreate withPublicKey(String publicKey); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + HybridIdentityMetadata refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + HybridIdentityMetadata refresh(Context context); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HybridIdentityMetadataList.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HybridIdentityMetadataList.java new file mode 100644 index 000000000000..f8f23d2103ee --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HybridIdentityMetadataList.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.connectedvmware.fluent.models.HybridIdentityMetadataInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of HybridIdentityMetadata. */ +@Fluent +public final class HybridIdentityMetadataList { + /* + * Url to follow for getting next page of HybridIdentityMetadata. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * Array of HybridIdentityMetadata + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the nextLink property: Url to follow for getting next page of HybridIdentityMetadata. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to follow for getting next page of HybridIdentityMetadata. + * + * @param nextLink the nextLink value to set. + * @return the HybridIdentityMetadataList object itself. + */ + public HybridIdentityMetadataList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: Array of HybridIdentityMetadata. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of HybridIdentityMetadata. + * + * @param value the value value to set. + * @return the HybridIdentityMetadataList object itself. + */ + public HybridIdentityMetadataList 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 HybridIdentityMetadataList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HybridIdentityMetadataList.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HybridIdentityMetadatas.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HybridIdentityMetadatas.java new file mode 100644 index 000000000000..88cc8668f629 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/HybridIdentityMetadatas.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of HybridIdentityMetadatas. */ +public interface HybridIdentityMetadatas { + /** + * Implements HybridIdentityMetadata GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the HybridIdentityMetadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the HybridIdentityMetadata. + */ + HybridIdentityMetadata get(String resourceGroupName, String virtualMachineName, String metadataName); + + /** + * Implements HybridIdentityMetadata GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the HybridIdentityMetadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the HybridIdentityMetadata along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String virtualMachineName, String metadataName, Context context); + + /** + * Implements HybridIdentityMetadata DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the HybridIdentityMetadata. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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, String metadataName); + + /** + * Implements HybridIdentityMetadata DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param metadataName Name of the HybridIdentityMetadata. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 virtualMachineName, String metadataName, Context context); + + /** + * Returns the list of HybridIdentityMetadata of the given vm. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 HybridIdentityMetadata as paginated response with {@link PagedIterable}. + */ + PagedIterable listByVm(String resourceGroupName, String virtualMachineName); + + /** + * Returns the list of HybridIdentityMetadata of the given vm. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the vm. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 HybridIdentityMetadata as paginated response with {@link PagedIterable}. + */ + PagedIterable listByVm( + String resourceGroupName, String virtualMachineName, Context context); + + /** + * Implements HybridIdentityMetadata 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 defines the HybridIdentityMetadata along with {@link Response}. + */ + HybridIdentityMetadata getById(String id); + + /** + * Implements HybridIdentityMetadata 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 defines the HybridIdentityMetadata along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Implements HybridIdentityMetadata DELETE 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. + */ + void deleteById(String id); + + /** + * Implements HybridIdentityMetadata DELETE 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 {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new HybridIdentityMetadata resource. + * + * @param name resource name. + * @return the first stage of the new HybridIdentityMetadata definition. + */ + HybridIdentityMetadata.DefinitionStages.Blank define(String name); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Identity.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Identity.java new file mode 100644 index 000000000000..ffb75b624c47 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Identity.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Managed service identity. */ +@Fluent +public class Identity { + /* + * The principal id of managed service identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant of managed service identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The type of managed service identity. + */ + @JsonProperty(value = "type", required = true) + private IdentityType type; + + /** + * Get the principalId property: The principal id of managed service identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant of managed service identity. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type of managed service identity. + * + * @return the type value. + */ + public IdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of managed service identity. + * + * @param type the type value to set. + * @return the Identity object itself. + */ + public Identity withType(IdentityType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property type in model Identity")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Identity.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/IdentityType.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/IdentityType.java new file mode 100644 index 000000000000..e21c713f8c97 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/IdentityType.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.connectedvmware.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for IdentityType. */ +public final class IdentityType extends ExpandableStringEnum { + /** Static value None for IdentityType. */ + public static final IdentityType NONE = fromString("None"); + + /** Static value SystemAssigned for IdentityType. */ + public static final IdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * Creates or finds a IdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding IdentityType. + */ + @JsonCreator + public static IdentityType fromString(String name) { + return fromString(name, IdentityType.class); + } + + /** + * Gets known IdentityType values. + * + * @return known IdentityType values. + */ + public static Collection values() { + return values(IdentityType.class); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/InventoryItem.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/InventoryItem.java new file mode 100644 index 000000000000..b86d4850475e --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/InventoryItem.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.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 or sets the tracked resource id corresponding to the inventory + * resource. + * + * @return the managedResourceId value. + */ + String managedResourceId(); + + /** + * Gets the moRefId property: Gets or sets the MoRef (Managed Object Reference) ID for the inventory item. + * + * @return the moRefId value. + */ + String moRefId(); + + /** + * Gets the moName property: Gets or sets the vCenter Managed Object name for the inventory item. + * + * @return the moName value. + */ + String moName(); + + /** + * Gets the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.connectedvmware.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, vcenterName. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @return the next definition stage. + */ + WithCreate withExistingVcenter(String resourceGroupName, String vcenterName); + } + /** + * 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, + DefinitionStages.WithManagedResourceId, + DefinitionStages.WithMoRefId, + DefinitionStages.WithMoName { + /** + * 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); + } + /** The stage of the InventoryItem definition allowing to specify managedResourceId. */ + interface WithManagedResourceId { + /** + * Specifies the managedResourceId property: Gets or sets the tracked resource id corresponding to the + * inventory resource.. + * + * @param managedResourceId Gets or sets the tracked resource id corresponding to the inventory resource. + * @return the next definition stage. + */ + WithCreate withManagedResourceId(String managedResourceId); + } + /** The stage of the InventoryItem definition allowing to specify moRefId. */ + interface WithMoRefId { + /** + * Specifies the moRefId property: Gets or sets the MoRef (Managed Object Reference) ID for the inventory + * item.. + * + * @param moRefId Gets or sets the MoRef (Managed Object Reference) ID for the inventory item. + * @return the next definition stage. + */ + WithCreate withMoRefId(String moRefId); + } + /** The stage of the InventoryItem definition allowing to specify moName. */ + interface WithMoName { + /** + * Specifies the moName property: Gets or sets the vCenter Managed Object name for the inventory item.. + * + * @param moName Gets or sets the vCenter Managed Object name for the inventory item. + * @return the next definition stage. + */ + WithCreate withMoName(String moName); + } + } + /** + * 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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/InventoryItemDetails.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/InventoryItemDetails.java new file mode 100644 index 000000000000..3fa454100936 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.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 vCenter Managed Object name for the resource. + */ + @JsonProperty(value = "moName") + private String moName; + + /** + * 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 moName property: Gets or sets the vCenter Managed Object name for the resource. + * + * @return the moName value. + */ + public String moName() { + return this.moName; + } + + /** + * Set the moName property: Gets or sets the vCenter Managed Object name for the resource. + * + * @param moName the moName value to set. + * @return the InventoryItemDetails object itself. + */ + public InventoryItemDetails withMoName(String moName) { + this.moName = moName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/InventoryItems.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/InventoryItems.java new file mode 100644 index 000000000000..d9be0cc4bdc2 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.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 { + /** + * Implements InventoryItem GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, String inventoryItemName); + + /** + * Implements InventoryItem GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, String inventoryItemName, Context context); + + /** + * Implements inventoryItem DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, String inventoryItemName); + + /** + * Implements inventoryItem DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @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 vcenterName, String inventoryItemName, Context context); + + /** + * Returns the list of inventoryItems of the given vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 listByVCenter(String resourceGroupName, String vcenterName); + + /** + * Returns the list of inventoryItems of the given vCenter. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 listByVCenter(String resourceGroupName, String vcenterName, Context context); + + /** + * Implements InventoryItem 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 defines the inventory item along with {@link Response}. + */ + InventoryItem getById(String id); + + /** + * Implements InventoryItem 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 defines the inventory item along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Implements inventoryItem DELETE 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. + */ + void deleteById(String id); + + /** + * Implements inventoryItem DELETE 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 {@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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/InventoryItemsList.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/InventoryItemsList.java new file mode 100644 index 000000000000..6f1479214382 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.connectedvmware.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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/InventoryType.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/InventoryType.java new file mode 100644 index 000000000000..ddb9224c2eef --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/InventoryType.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.connectedvmware.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 ResourcePool for InventoryType. */ + public static final InventoryType RESOURCE_POOL = fromString("ResourcePool"); + + /** Static value VirtualMachine for InventoryType. */ + public static final InventoryType VIRTUAL_MACHINE = fromString("VirtualMachine"); + + /** Static value VirtualMachineTemplate for InventoryType. */ + public static final InventoryType VIRTUAL_MACHINE_TEMPLATE = fromString("VirtualMachineTemplate"); + + /** Static value VirtualNetwork for InventoryType. */ + public static final InventoryType VIRTUAL_NETWORK = fromString("VirtualNetwork"); + + /** Static value Cluster for InventoryType. */ + public static final InventoryType CLUSTER = fromString("Cluster"); + + /** Static value Datastore for InventoryType. */ + public static final InventoryType DATASTORE = fromString("Datastore"); + + /** Static value Host for InventoryType. */ + public static final InventoryType HOST = fromString("Host"); + + /** + * 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); + } + + /** + * Gets known InventoryType values. + * + * @return known InventoryType values. + */ + public static Collection values() { + return values(InventoryType.class); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/IpAddressAllocationMethod.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/IpAddressAllocationMethod.java new file mode 100644 index 000000000000..c416039cf236 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/IpAddressAllocationMethod.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.connectedvmware.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for IpAddressAllocationMethod. */ +public final class IpAddressAllocationMethod extends ExpandableStringEnum { + /** Static value unset for IpAddressAllocationMethod. */ + public static final IpAddressAllocationMethod UNSET = fromString("unset"); + + /** Static value dynamic for IpAddressAllocationMethod. */ + public static final IpAddressAllocationMethod DYNAMIC = fromString("dynamic"); + + /** Static value static for IpAddressAllocationMethod. */ + public static final IpAddressAllocationMethod STATIC = fromString("static"); + + /** Static value linklayer for IpAddressAllocationMethod. */ + public static final IpAddressAllocationMethod LINKLAYER = fromString("linklayer"); + + /** Static value random for IpAddressAllocationMethod. */ + public static final IpAddressAllocationMethod RANDOM = fromString("random"); + + /** Static value other for IpAddressAllocationMethod. */ + public static final IpAddressAllocationMethod OTHER = fromString("other"); + + /** + * Creates or finds a IpAddressAllocationMethod from its string representation. + * + * @param name a name to look for. + * @return the corresponding IpAddressAllocationMethod. + */ + @JsonCreator + public static IpAddressAllocationMethod fromString(String name) { + return fromString(name, IpAddressAllocationMethod.class); + } + + /** + * Gets known IpAddressAllocationMethod values. + * + * @return known IpAddressAllocationMethod values. + */ + public static Collection values() { + return values(IpAddressAllocationMethod.class); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/MachineExtension.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/MachineExtension.java new file mode 100644 index 000000000000..46c71f46fb23 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/MachineExtension.java @@ -0,0 +1,452 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.fluent.models.MachineExtensionInner; +import java.util.Map; + +/** An immutable client-side representation of MachineExtension. */ +public interface MachineExtension { + /** + * 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 forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @return the forceUpdateTag value. + */ + String forceUpdateTag(); + + /** + * Gets the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + String publisher(); + + /** + * Gets the typePropertiesType property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the typePropertiesType value. + */ + String typePropertiesType(); + + /** + * Gets the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + String typeHandlerVersion(); + + /** + * Gets the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if + * one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + Boolean autoUpgradeMinorVersion(); + + /** + * Gets the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + Object settings(); + + /** + * Gets the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + Object protectedSettings(); + + /** + * Gets the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the instanceView property: The machine extension instance view. + * + * @return the instanceView value. + */ + MachineExtensionPropertiesInstanceView instanceView(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.connectedvmware.fluent.models.MachineExtensionInner object. + * + * @return the inner object. + */ + MachineExtensionInner innerModel(); + + /** The entirety of the MachineExtension definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The MachineExtension definition stages. */ + interface DefinitionStages { + /** The first stage of the MachineExtension definition. */ + interface Blank extends WithLocation { + } + /** The stage of the MachineExtension definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the MachineExtension definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, name. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be created or updated. + * @return the next definition stage. + */ + WithCreate withExistingVirtualMachine(String resourceGroupName, String name); + } + /** + * The stage of the MachineExtension definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithForceUpdateTag, + DefinitionStages.WithPublisher, + DefinitionStages.WithTypePropertiesType, + DefinitionStages.WithTypeHandlerVersion, + DefinitionStages.WithAutoUpgradeMinorVersion, + DefinitionStages.WithSettings, + DefinitionStages.WithProtectedSettings, + DefinitionStages.WithInstanceView { + /** + * Executes the create request. + * + * @return the created resource. + */ + MachineExtension create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + MachineExtension create(Context context); + } + /** The stage of the MachineExtension 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 MachineExtension definition allowing to specify forceUpdateTag. */ + interface WithForceUpdateTag { + /** + * Specifies the forceUpdateTag property: How the extension handler should be forced to update even if the + * extension configuration has not changed.. + * + * @param forceUpdateTag How the extension handler should be forced to update even if the extension + * configuration has not changed. + * @return the next definition stage. + */ + WithCreate withForceUpdateTag(String forceUpdateTag); + } + /** The stage of the MachineExtension definition allowing to specify publisher. */ + interface WithPublisher { + /** + * Specifies the publisher property: The name of the extension handler publisher.. + * + * @param publisher The name of the extension handler publisher. + * @return the next definition stage. + */ + WithCreate withPublisher(String publisher); + } + /** The stage of the MachineExtension definition allowing to specify typePropertiesType. */ + interface WithTypePropertiesType { + /** + * Specifies the typePropertiesType property: Specifies the type of the extension; an example is + * "CustomScriptExtension".. + * + * @param typePropertiesType Specifies the type of the extension; an example is "CustomScriptExtension". + * @return the next definition stage. + */ + WithCreate withTypePropertiesType(String typePropertiesType); + } + /** The stage of the MachineExtension definition allowing to specify typeHandlerVersion. */ + interface WithTypeHandlerVersion { + /** + * Specifies the typeHandlerVersion property: Specifies the version of the script handler.. + * + * @param typeHandlerVersion Specifies the version of the script handler. + * @return the next definition stage. + */ + WithCreate withTypeHandlerVersion(String typeHandlerVersion); + } + /** The stage of the MachineExtension definition allowing to specify autoUpgradeMinorVersion. */ + interface WithAutoUpgradeMinorVersion { + /** + * Specifies the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor + * version if one is available at deployment time. Once deployed, however, the extension will not upgrade + * minor versions unless redeployed, even with this property set to true.. + * + * @param autoUpgradeMinorVersion Indicates whether the extension should use a newer minor version if one is + * available at deployment time. Once deployed, however, the extension will not upgrade minor versions + * unless redeployed, even with this property set to true. + * @return the next definition stage. + */ + WithCreate withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion); + } + /** The stage of the MachineExtension definition allowing to specify settings. */ + interface WithSettings { + /** + * Specifies the settings property: Json formatted public settings for the extension.. + * + * @param settings Json formatted public settings for the extension. + * @return the next definition stage. + */ + WithCreate withSettings(Object settings); + } + /** The stage of the MachineExtension definition allowing to specify protectedSettings. */ + interface WithProtectedSettings { + /** + * Specifies the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all.. + * + * @param protectedSettings The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * @return the next definition stage. + */ + WithCreate withProtectedSettings(Object protectedSettings); + } + /** The stage of the MachineExtension definition allowing to specify instanceView. */ + interface WithInstanceView { + /** + * Specifies the instanceView property: The machine extension instance view.. + * + * @param instanceView The machine extension instance view. + * @return the next definition stage. + */ + WithCreate withInstanceView(MachineExtensionPropertiesInstanceView instanceView); + } + } + /** + * Begins update for the MachineExtension resource. + * + * @return the stage of resource update. + */ + MachineExtension.Update update(); + + /** The template for MachineExtension update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithForceUpdateTag, + UpdateStages.WithPublisher, + UpdateStages.WithType, + UpdateStages.WithTypeHandlerVersion, + UpdateStages.WithAutoUpgradeMinorVersion, + UpdateStages.WithSettings, + UpdateStages.WithProtectedSettings { + /** + * Executes the update request. + * + * @return the updated resource. + */ + MachineExtension apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + MachineExtension apply(Context context); + } + /** The MachineExtension update stages. */ + interface UpdateStages { + /** The stage of the MachineExtension update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the MachineExtension update allowing to specify forceUpdateTag. */ + interface WithForceUpdateTag { + /** + * Specifies the forceUpdateTag property: How the extension handler should be forced to update even if the + * extension configuration has not changed.. + * + * @param forceUpdateTag How the extension handler should be forced to update even if the extension + * configuration has not changed. + * @return the next definition stage. + */ + Update withForceUpdateTag(String forceUpdateTag); + } + /** The stage of the MachineExtension update allowing to specify publisher. */ + interface WithPublisher { + /** + * Specifies the publisher property: The name of the extension handler publisher.. + * + * @param publisher The name of the extension handler publisher. + * @return the next definition stage. + */ + Update withPublisher(String publisher); + } + /** The stage of the MachineExtension update allowing to specify type. */ + interface WithType { + /** + * Specifies the type property: Specifies the type of the extension; an example is "CustomScriptExtension".. + * + * @param type Specifies the type of the extension; an example is "CustomScriptExtension". + * @return the next definition stage. + */ + Update withType(String type); + } + /** The stage of the MachineExtension update allowing to specify typeHandlerVersion. */ + interface WithTypeHandlerVersion { + /** + * Specifies the typeHandlerVersion property: Specifies the version of the script handler.. + * + * @param typeHandlerVersion Specifies the version of the script handler. + * @return the next definition stage. + */ + Update withTypeHandlerVersion(String typeHandlerVersion); + } + /** The stage of the MachineExtension update allowing to specify autoUpgradeMinorVersion. */ + interface WithAutoUpgradeMinorVersion { + /** + * Specifies the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor + * version if one is available at deployment time. Once deployed, however, the extension will not upgrade + * minor versions unless redeployed, even with this property set to true.. + * + * @param autoUpgradeMinorVersion Indicates whether the extension should use a newer minor version if one is + * available at deployment time. Once deployed, however, the extension will not upgrade minor versions + * unless redeployed, even with this property set to true. + * @return the next definition stage. + */ + Update withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion); + } + /** The stage of the MachineExtension update allowing to specify settings. */ + interface WithSettings { + /** + * Specifies the settings property: Json formatted public settings for the extension.. + * + * @param settings Json formatted public settings for the extension. + * @return the next definition stage. + */ + Update withSettings(Object settings); + } + /** The stage of the MachineExtension update allowing to specify protectedSettings. */ + interface WithProtectedSettings { + /** + * Specifies the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all.. + * + * @param protectedSettings The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * @return the next definition stage. + */ + Update withProtectedSettings(Object protectedSettings); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + MachineExtension refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + MachineExtension refresh(Context context); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/MachineExtensionInstanceView.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/MachineExtensionInstanceView.java new file mode 100644 index 000000000000..6eb1b0c200c8 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/MachineExtensionInstanceView.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the Machine Extension Instance View. */ +@Fluent +public class MachineExtensionInstanceView { + /* + * The machine extension name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Specifies the type of the extension; an example is + * "CustomScriptExtension". + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Specifies the version of the script handler. + */ + @JsonProperty(value = "typeHandlerVersion", access = JsonProperty.Access.WRITE_ONLY) + private String typeHandlerVersion; + + /* + * Instance view status. + */ + @JsonProperty(value = "status") + private MachineExtensionInstanceViewStatus status; + + /** + * Get the name property: The machine extension name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.typeHandlerVersion; + } + + /** + * Get the status property: Instance view status. + * + * @return the status value. + */ + public MachineExtensionInstanceViewStatus status() { + return this.status; + } + + /** + * Set the status property: Instance view status. + * + * @param status the status value to set. + * @return the MachineExtensionInstanceView object itself. + */ + public MachineExtensionInstanceView withStatus(MachineExtensionInstanceViewStatus status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() != null) { + status().validate(); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/MachineExtensionInstanceViewStatus.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/MachineExtensionInstanceViewStatus.java new file mode 100644 index 000000000000..28d3ed2fe005 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/MachineExtensionInstanceViewStatus.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Instance view status. */ +@Immutable +public final class MachineExtensionInstanceViewStatus { + /* + * The status code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /* + * The level code. + */ + @JsonProperty(value = "level", access = JsonProperty.Access.WRITE_ONLY) + private StatusLevelTypes level; + + /* + * The short localizable label for the status. + */ + @JsonProperty(value = "displayStatus", access = JsonProperty.Access.WRITE_ONLY) + private String displayStatus; + + /* + * The detailed status message, including for alerts and error messages. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /* + * The time of the status. + */ + @JsonProperty(value = "time", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime time; + + /** + * Get the code property: The status code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Get the level property: The level code. + * + * @return the level value. + */ + public StatusLevelTypes level() { + return this.level; + } + + /** + * Get the displayStatus property: The short localizable label for the status. + * + * @return the displayStatus value. + */ + public String displayStatus() { + return this.displayStatus; + } + + /** + * Get the message property: The detailed status message, including for alerts and error messages. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Get the time property: The time of the status. + * + * @return the time value. + */ + public OffsetDateTime time() { + return this.time; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/MachineExtensionPropertiesInstanceView.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/MachineExtensionPropertiesInstanceView.java new file mode 100644 index 000000000000..aab7f80ab32f --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/MachineExtensionPropertiesInstanceView.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Fluent; + +/** The machine extension instance view. */ +@Fluent +public final class MachineExtensionPropertiesInstanceView extends MachineExtensionInstanceView { + /** {@inheritDoc} */ + @Override + public MachineExtensionPropertiesInstanceView withStatus(MachineExtensionInstanceViewStatus status) { + super.withStatus(status); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/MachineExtensionUpdate.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/MachineExtensionUpdate.java new file mode 100644 index 000000000000..95e8785ef16c --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/MachineExtensionUpdate.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.fluent.models.MachineExtensionUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Describes a Machine Extension Update. */ +@Fluent +public final class MachineExtensionUpdate extends ResourcePatch { + /* + * Describes Machine Extension Update Properties. + */ + @JsonProperty(value = "properties") + private MachineExtensionUpdateProperties innerProperties; + + /** + * Get the innerProperties property: Describes Machine Extension Update Properties. + * + * @return the innerProperties value. + */ + private MachineExtensionUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public MachineExtensionUpdate withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.innerProperties() == null ? null : this.innerProperties().forceUpdateTag(); + } + + /** + * Set the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the MachineExtensionUpdate object itself. + */ + public MachineExtensionUpdate withForceUpdateTag(String forceUpdateTag) { + if (this.innerProperties() == null) { + this.innerProperties = new MachineExtensionUpdateProperties(); + } + this.innerProperties().withForceUpdateTag(forceUpdateTag); + return this; + } + + /** + * Get the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.innerProperties() == null ? null : this.innerProperties().publisher(); + } + + /** + * Set the publisher property: The name of the extension handler publisher. + * + * @param publisher the publisher value to set. + * @return the MachineExtensionUpdate object itself. + */ + public MachineExtensionUpdate withPublisher(String publisher) { + if (this.innerProperties() == null) { + this.innerProperties = new MachineExtensionUpdateProperties(); + } + this.innerProperties().withPublisher(publisher); + return this; + } + + /** + * Get the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the type value. + */ + public String type() { + return this.innerProperties() == null ? null : this.innerProperties().type(); + } + + /** + * Set the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @param type the type value to set. + * @return the MachineExtensionUpdate object itself. + */ + public MachineExtensionUpdate withType(String type) { + if (this.innerProperties() == null) { + this.innerProperties = new MachineExtensionUpdateProperties(); + } + this.innerProperties().withType(type); + return this; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.innerProperties() == null ? null : this.innerProperties().typeHandlerVersion(); + } + + /** + * Set the typeHandlerVersion property: Specifies the version of the script handler. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the MachineExtensionUpdate object itself. + */ + public MachineExtensionUpdate withTypeHandlerVersion(String typeHandlerVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new MachineExtensionUpdateProperties(); + } + this.innerProperties().withTypeHandlerVersion(typeHandlerVersion); + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.innerProperties() == null ? null : this.innerProperties().autoUpgradeMinorVersion(); + } + + /** + * Set the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the MachineExtensionUpdate object itself. + */ + public MachineExtensionUpdate withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new MachineExtensionUpdateProperties(); + } + this.innerProperties().withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } + + /** + * Get the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + public Object settings() { + return this.innerProperties() == null ? null : this.innerProperties().settings(); + } + + /** + * Set the settings property: Json formatted public settings for the extension. + * + * @param settings the settings value to set. + * @return the MachineExtensionUpdate object itself. + */ + public MachineExtensionUpdate withSettings(Object settings) { + if (this.innerProperties() == null) { + this.innerProperties = new MachineExtensionUpdateProperties(); + } + this.innerProperties().withSettings(settings); + return this; + } + + /** + * Get the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + public Object protectedSettings() { + return this.innerProperties() == null ? null : this.innerProperties().protectedSettings(); + } + + /** + * Set the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @param protectedSettings the protectedSettings value to set. + * @return the MachineExtensionUpdate object itself. + */ + public MachineExtensionUpdate withProtectedSettings(Object protectedSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new MachineExtensionUpdateProperties(); + } + this.innerProperties().withProtectedSettings(protectedSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/MachineExtensions.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/MachineExtensions.java new file mode 100644 index 000000000000..ce7e5bada03e --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/MachineExtensions.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.connectedvmware.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 MachineExtensions. */ +public interface MachineExtensions { + /** + * The operation to delete the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 name, String extensionName); + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 name, String extensionName, Context context); + + /** + * The operation to get the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine containing the extension. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + MachineExtension get(String resourceGroupName, String name, String extensionName); + + /** + * The operation to get the extension. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine containing the extension. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String name, String extensionName, Context context); + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine containing the extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the Machine Extensions List Result as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String name); + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The Resource Group Name. + * @param name The name of the machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the Machine Extensions List Result as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String name, String expand, Context context); + + /** + * The operation to get the extension. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension along with {@link Response}. + */ + MachineExtension getById(String id); + + /** + * The operation to get the extension. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * The operation to delete the extension. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * The operation to delete the extension. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new MachineExtension resource. + * + * @param name resource name. + * @return the first stage of the new MachineExtension definition. + */ + MachineExtension.DefinitionStages.Blank define(String name); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/MachineExtensionsListResult.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/MachineExtensionsListResult.java new file mode 100644 index 000000000000..0b97abf2cf73 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/MachineExtensionsListResult.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.fluent.models.MachineExtensionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the Machine Extensions List Result. */ +@Fluent +public final class MachineExtensionsListResult { + /* + * The list of extensions + */ + @JsonProperty(value = "value") + private List value; + + /* + * The uri to fetch the next page of machine extensions. Call ListNext() + * with this to fetch the next page of extensions. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of extensions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of extensions. + * + * @param value the value value to set. + * @return the MachineExtensionsListResult object itself. + */ + public MachineExtensionsListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of machine extensions. Call ListNext() with this to + * fetch the next page of extensions. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of machine extensions. Call ListNext() with this to + * fetch the next page of extensions. + * + * @param nextLink the nextLink value to set. + * @return the MachineExtensionsListResult object itself. + */ + public MachineExtensionsListResult 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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/NetworkInterface.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/NetworkInterface.java new file mode 100644 index 000000000000..c99d1e50dc21 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/NetworkInterface.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.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Network Interface model. */ +@Fluent +public final class NetworkInterface { + /* + * Gets or sets the name of the network interface. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Gets or sets the label of the virtual network in vCenter that the nic is + * connected to. + */ + @JsonProperty(value = "label", access = JsonProperty.Access.WRITE_ONLY) + private String label; + + /* + * Gets or sets the nic ip addresses. + */ + @JsonProperty(value = "ipAddresses", access = JsonProperty.Access.WRITE_ONLY) + private List ipAddresses; + + /* + * Gets or sets the NIC MAC address. + */ + @JsonProperty(value = "macAddress", access = JsonProperty.Access.WRITE_ONLY) + private String macAddress; + + /* + * Gets or sets the ARM Id of the network resource to connect the virtual + * machine. + */ + @JsonProperty(value = "networkId") + private String networkId; + + /* + * NIC type + */ + @JsonProperty(value = "nicType") + private NicType nicType; + + /* + * Gets or sets the power on boot. + */ + @JsonProperty(value = "powerOnBoot") + private PowerOnBootOption powerOnBoot; + + /* + * Gets or sets the vCenter MoRef (Managed Object Reference) ID of the + * virtual network + * that the nic is connected to. + */ + @JsonProperty(value = "networkMoRefId", access = JsonProperty.Access.WRITE_ONLY) + private String networkMoRefId; + + /* + * Gets or sets the name of the virtual network in vCenter that the nic is + * connected to. + */ + @JsonProperty(value = "networkMoName", access = JsonProperty.Access.WRITE_ONLY) + private String networkMoName; + + /* + * Gets or sets the device key value. + */ + @JsonProperty(value = "deviceKey") + private Integer deviceKey; + + /* + * Gets or sets the ipsettings. + */ + @JsonProperty(value = "ipSettings") + private NicIpSettings ipSettings; + + /** + * 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 NetworkInterface object itself. + */ + public NetworkInterface withName(String name) { + this.name = name; + return this; + } + + /** + * Get the label property: Gets or sets the label of the virtual network in vCenter that the nic is connected to. + * + * @return the label value. + */ + public String label() { + return this.label; + } + + /** + * Get the ipAddresses property: Gets or sets the nic ip addresses. + * + * @return the ipAddresses value. + */ + public List ipAddresses() { + return this.ipAddresses; + } + + /** + * Get the macAddress property: Gets or sets the NIC MAC address. + * + * @return the macAddress value. + */ + public String macAddress() { + return this.macAddress; + } + + /** + * Get the networkId property: Gets or sets the ARM Id of the network resource to connect the virtual machine. + * + * @return the networkId value. + */ + public String networkId() { + return this.networkId; + } + + /** + * Set the networkId property: Gets or sets the ARM Id of the network resource to connect the virtual machine. + * + * @param networkId the networkId value to set. + * @return the NetworkInterface object itself. + */ + public NetworkInterface withNetworkId(String networkId) { + this.networkId = networkId; + return this; + } + + /** + * Get the nicType property: NIC type. + * + * @return the nicType value. + */ + public NicType nicType() { + return this.nicType; + } + + /** + * Set the nicType property: NIC type. + * + * @param nicType the nicType value to set. + * @return the NetworkInterface object itself. + */ + public NetworkInterface withNicType(NicType nicType) { + this.nicType = nicType; + return this; + } + + /** + * Get the powerOnBoot property: Gets or sets the power on boot. + * + * @return the powerOnBoot value. + */ + public PowerOnBootOption powerOnBoot() { + return this.powerOnBoot; + } + + /** + * Set the powerOnBoot property: Gets or sets the power on boot. + * + * @param powerOnBoot the powerOnBoot value to set. + * @return the NetworkInterface object itself. + */ + public NetworkInterface withPowerOnBoot(PowerOnBootOption powerOnBoot) { + this.powerOnBoot = powerOnBoot; + return this; + } + + /** + * Get the networkMoRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID of the virtual + * network that the nic is connected to. + * + * @return the networkMoRefId value. + */ + public String networkMoRefId() { + return this.networkMoRefId; + } + + /** + * Get the networkMoName property: Gets or sets the name of the virtual network in vCenter that the nic is connected + * to. + * + * @return the networkMoName value. + */ + public String networkMoName() { + return this.networkMoName; + } + + /** + * Get the deviceKey property: Gets or sets the device key value. + * + * @return the deviceKey value. + */ + public Integer deviceKey() { + return this.deviceKey; + } + + /** + * Set the deviceKey property: Gets or sets the device key value. + * + * @param deviceKey the deviceKey value to set. + * @return the NetworkInterface object itself. + */ + public NetworkInterface withDeviceKey(Integer deviceKey) { + this.deviceKey = deviceKey; + return this; + } + + /** + * Get the ipSettings property: Gets or sets the ipsettings. + * + * @return the ipSettings value. + */ + public NicIpSettings ipSettings() { + return this.ipSettings; + } + + /** + * Set the ipSettings property: Gets or sets the ipsettings. + * + * @param ipSettings the ipSettings value to set. + * @return the NetworkInterface object itself. + */ + public NetworkInterface withIpSettings(NicIpSettings ipSettings) { + this.ipSettings = ipSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ipSettings() != null) { + ipSettings().validate(); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/NetworkInterfaceUpdate.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/NetworkInterfaceUpdate.java new file mode 100644 index 000000000000..662461146b3a --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/NetworkInterfaceUpdate.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the network interface update. */ +@Fluent +public final class NetworkInterfaceUpdate { + /* + * Gets or sets the name of the network interface. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Gets or sets the ARM Id of the network resource to connect the virtual + * machine. + */ + @JsonProperty(value = "networkId") + private String networkId; + + /* + * NIC type + */ + @JsonProperty(value = "nicType") + private NicType nicType; + + /* + * Gets or sets the power on boot. + */ + @JsonProperty(value = "powerOnBoot") + private PowerOnBootOption powerOnBoot; + + /* + * Gets or sets the device key value. + */ + @JsonProperty(value = "deviceKey") + private Integer deviceKey; + + /** + * 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 NetworkInterfaceUpdate object itself. + */ + public NetworkInterfaceUpdate withName(String name) { + this.name = name; + return this; + } + + /** + * Get the networkId property: Gets or sets the ARM Id of the network resource to connect the virtual machine. + * + * @return the networkId value. + */ + public String networkId() { + return this.networkId; + } + + /** + * Set the networkId property: Gets or sets the ARM Id of the network resource to connect the virtual machine. + * + * @param networkId the networkId value to set. + * @return the NetworkInterfaceUpdate object itself. + */ + public NetworkInterfaceUpdate withNetworkId(String networkId) { + this.networkId = networkId; + return this; + } + + /** + * Get the nicType property: NIC type. + * + * @return the nicType value. + */ + public NicType nicType() { + return this.nicType; + } + + /** + * Set the nicType property: NIC type. + * + * @param nicType the nicType value to set. + * @return the NetworkInterfaceUpdate object itself. + */ + public NetworkInterfaceUpdate withNicType(NicType nicType) { + this.nicType = nicType; + return this; + } + + /** + * Get the powerOnBoot property: Gets or sets the power on boot. + * + * @return the powerOnBoot value. + */ + public PowerOnBootOption powerOnBoot() { + return this.powerOnBoot; + } + + /** + * Set the powerOnBoot property: Gets or sets the power on boot. + * + * @param powerOnBoot the powerOnBoot value to set. + * @return the NetworkInterfaceUpdate object itself. + */ + public NetworkInterfaceUpdate withPowerOnBoot(PowerOnBootOption powerOnBoot) { + this.powerOnBoot = powerOnBoot; + return this; + } + + /** + * Get the deviceKey property: Gets or sets the device key value. + * + * @return the deviceKey value. + */ + public Integer deviceKey() { + return this.deviceKey; + } + + /** + * Set the deviceKey property: Gets or sets the device key value. + * + * @param deviceKey the deviceKey value to set. + * @return the NetworkInterfaceUpdate object itself. + */ + public NetworkInterfaceUpdate withDeviceKey(Integer deviceKey) { + this.deviceKey = deviceKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/NetworkProfile.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/NetworkProfile.java new file mode 100644 index 000000000000..f44dda761213 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/NetworkProfileUpdate.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/NetworkProfileUpdate.java new file mode 100644 index 000000000000..9034f6d7ad9f --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Defines the update 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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/NicIpAddressSettings.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/NicIpAddressSettings.java new file mode 100644 index 000000000000..898f9c13b3f6 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/NicIpAddressSettings.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.connectedvmware.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** IP address information for a virtual network adapter reported by the fabric. */ +@Immutable +public final class NicIpAddressSettings { + /* + * Gets the ip address allocation method. + */ + @JsonProperty(value = "allocationMethod", access = JsonProperty.Access.WRITE_ONLY) + private String allocationMethod; + + /* + * Gets the ip address for the nic. + */ + @JsonProperty(value = "ipAddress", access = JsonProperty.Access.WRITE_ONLY) + private String ipAddress; + + /* + * Gets the mask. + */ + @JsonProperty(value = "subnetMask", access = JsonProperty.Access.WRITE_ONLY) + private String subnetMask; + + /** + * Get the allocationMethod property: Gets the ip address allocation method. + * + * @return the allocationMethod value. + */ + public String allocationMethod() { + return this.allocationMethod; + } + + /** + * Get the ipAddress property: Gets the ip address for the nic. + * + * @return the ipAddress value. + */ + public String ipAddress() { + return this.ipAddress; + } + + /** + * Get the subnetMask property: Gets the mask. + * + * @return the subnetMask value. + */ + public String subnetMask() { + return this.subnetMask; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/NicIpSettings.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/NicIpSettings.java new file mode 100644 index 000000000000..fbbb01ef240e --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/NicIpSettings.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Defines the network interface ip settings. */ +@Fluent +public final class NicIpSettings { + /* + * Gets or sets the nic allocation method. + */ + @JsonProperty(value = "allocationMethod") + private IpAddressAllocationMethod allocationMethod; + + /* + * Gets or sets the dns servers. + */ + @JsonProperty(value = "dnsServers") + private List dnsServers; + + /* + * Gets or sets the gateway. + */ + @JsonProperty(value = "gateway") + private List gateway; + + /* + * Gets or sets the ip address for the nic. + */ + @JsonProperty(value = "ipAddress") + private String ipAddress; + + /* + * Gets or sets the mask. + */ + @JsonProperty(value = "subnetMask") + private String subnetMask; + + /* + * Gets or sets the primary server. + */ + @JsonProperty(value = "primaryWinsServer", access = JsonProperty.Access.WRITE_ONLY) + private String primaryWinsServer; + + /* + * Gets or sets the secondary server. + */ + @JsonProperty(value = "secondaryWinsServer", access = JsonProperty.Access.WRITE_ONLY) + private String secondaryWinsServer; + + /* + * Gets or sets the IP address information being reported for this NIC. + * This contains the same IPv4 information above plus IPV6 information. + */ + @JsonProperty(value = "ipAddressInfo", access = JsonProperty.Access.WRITE_ONLY) + private List ipAddressInfo; + + /** + * Get the allocationMethod property: Gets or sets the nic allocation method. + * + * @return the allocationMethod value. + */ + public IpAddressAllocationMethod allocationMethod() { + return this.allocationMethod; + } + + /** + * Set the allocationMethod property: Gets or sets the nic allocation method. + * + * @param allocationMethod the allocationMethod value to set. + * @return the NicIpSettings object itself. + */ + public NicIpSettings withAllocationMethod(IpAddressAllocationMethod allocationMethod) { + this.allocationMethod = allocationMethod; + return this; + } + + /** + * Get the dnsServers property: Gets or sets the dns servers. + * + * @return the dnsServers value. + */ + public List dnsServers() { + return this.dnsServers; + } + + /** + * Set the dnsServers property: Gets or sets the dns servers. + * + * @param dnsServers the dnsServers value to set. + * @return the NicIpSettings object itself. + */ + public NicIpSettings withDnsServers(List dnsServers) { + this.dnsServers = dnsServers; + return this; + } + + /** + * Get the gateway property: Gets or sets the gateway. + * + * @return the gateway value. + */ + public List gateway() { + return this.gateway; + } + + /** + * Set the gateway property: Gets or sets the gateway. + * + * @param gateway the gateway value to set. + * @return the NicIpSettings object itself. + */ + public NicIpSettings withGateway(List gateway) { + this.gateway = gateway; + return this; + } + + /** + * Get the ipAddress property: Gets or sets the ip address for the nic. + * + * @return the ipAddress value. + */ + public String ipAddress() { + return this.ipAddress; + } + + /** + * Set the ipAddress property: Gets or sets the ip address for the nic. + * + * @param ipAddress the ipAddress value to set. + * @return the NicIpSettings object itself. + */ + public NicIpSettings withIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + return this; + } + + /** + * Get the subnetMask property: Gets or sets the mask. + * + * @return the subnetMask value. + */ + public String subnetMask() { + return this.subnetMask; + } + + /** + * Set the subnetMask property: Gets or sets the mask. + * + * @param subnetMask the subnetMask value to set. + * @return the NicIpSettings object itself. + */ + public NicIpSettings withSubnetMask(String subnetMask) { + this.subnetMask = subnetMask; + return this; + } + + /** + * Get the primaryWinsServer property: Gets or sets the primary server. + * + * @return the primaryWinsServer value. + */ + public String primaryWinsServer() { + return this.primaryWinsServer; + } + + /** + * Get the secondaryWinsServer property: Gets or sets the secondary server. + * + * @return the secondaryWinsServer value. + */ + public String secondaryWinsServer() { + return this.secondaryWinsServer; + } + + /** + * Get the ipAddressInfo property: Gets or sets the IP address information being reported for this NIC. This + * contains the same IPv4 information above plus IPV6 information. + * + * @return the ipAddressInfo value. + */ + public List ipAddressInfo() { + return this.ipAddressInfo; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ipAddressInfo() != null) { + ipAddressInfo().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/NicType.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/NicType.java new file mode 100644 index 000000000000..79c4fa274dcd --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/NicType.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.connectedvmware.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NicType. */ +public final class NicType extends ExpandableStringEnum { + /** Static value vmxnet3 for NicType. */ + public static final NicType VMXNET3 = fromString("vmxnet3"); + + /** Static value vmxnet2 for NicType. */ + public static final NicType VMXNET2 = fromString("vmxnet2"); + + /** Static value vmxnet for NicType. */ + public static final NicType VMXNET = fromString("vmxnet"); + + /** Static value e1000 for NicType. */ + public static final NicType E1000 = fromString("e1000"); + + /** Static value e1000e for NicType. */ + public static final NicType E1000E = fromString("e1000e"); + + /** Static value pcnet32 for NicType. */ + public static final NicType PCNET32 = fromString("pcnet32"); + + /** + * Creates or finds a NicType from its string representation. + * + * @param name a name to look for. + * @return the corresponding NicType. + */ + @JsonCreator + public static NicType fromString(String name) { + return fromString(name, NicType.class); + } + + /** + * Gets known NicType values. + * + * @return known NicType values. + */ + public static Collection values() { + return values(NicType.class); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Operation.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Operation.java new file mode 100644 index 000000000000..53e8e2232636 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Operation.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.connectedvmware.models; + +import com.azure.resourcemanager.connectedvmware.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: Name of the operation. + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Indicates whether the operation is data action or not. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Properties of the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the inner com.azure.resourcemanager.connectedvmware.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/OperationDisplay.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/OperationDisplay.java new file mode 100644 index 000000000000..e5526d0d0da2 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/OperationDisplay.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.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of the operation. */ +@Fluent +public final class OperationDisplay { + /* + * Provider name + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Resource name + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Operation name + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Description of the operation + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Provider name. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Provider name. + * + * @param provider the provider value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource name. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource name. + * + * @param resource the resource value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Operation name. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Operation name. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Description of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the operation. + * + * @param description the description value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay 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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Operations.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/Operations.java new file mode 100644 index 000000000000..3ba3a91c55d3 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.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 lists the operations available 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 lists the operations available as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/OperationsList.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/OperationsList.java new file mode 100644 index 000000000000..63e1a8148afa --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/OperationsList.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.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.connectedvmware.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Lists the operations available. */ +@Fluent +public final class OperationsList { + /* + * Url to follow for getting next page of operations. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * Array of operations + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the nextLink property: Url to follow for getting next page of operations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to follow for getting next page of operations. + * + * @param nextLink the nextLink value to set. + * @return the OperationsList object itself. + */ + public OperationsList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: Array of operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of operations. + * + * @param value the value value to set. + * @return the OperationsList object itself. + */ + public OperationsList 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 OperationsList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OperationsList.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/OsProfile.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/OsProfile.java new file mode 100644 index 000000000000..ce52feb7fbac --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/OsProfile.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the resource properties. */ +@Fluent +public final class OsProfile { + /* + * Gets or sets computer name. + */ + @JsonProperty(value = "computerName") + private String computerName; + + /* + * Gets or sets administrator username. + */ + @JsonProperty(value = "adminUsername") + private String adminUsername; + + /* + * Gets or sets administrator password. + */ + @JsonProperty(value = "adminPassword") + private String adminPassword; + + /* + * Gets or sets the type of the os. + */ + @JsonProperty(value = "osType") + private OsType osType; + + /* + * Gets or sets os name. + */ + @JsonProperty(value = "osName", access = JsonProperty.Access.WRITE_ONLY) + private String osName; + + /* + * Gets or sets the current running status of VMware Tools running in the + * guest operating system. + */ + @JsonProperty(value = "toolsRunningStatus", access = JsonProperty.Access.WRITE_ONLY) + private String toolsRunningStatus; + + /* + * Gets or sets the current version status of VMware Tools installed in the + * guest operating system. + */ + @JsonProperty(value = "toolsVersionStatus", access = JsonProperty.Access.WRITE_ONLY) + private String toolsVersionStatus; + + /* + * Gets or sets the current version of VMware Tools. + */ + @JsonProperty(value = "toolsVersion", access = JsonProperty.Access.WRITE_ONLY) + private String toolsVersion; + + /** + * 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 adminUsername property: Gets or sets administrator username. + * + * @return the adminUsername value. + */ + public String adminUsername() { + return this.adminUsername; + } + + /** + * Set the adminUsername property: Gets or sets administrator username. + * + * @param adminUsername the adminUsername value to set. + * @return the OsProfile object itself. + */ + public OsProfile withAdminUsername(String adminUsername) { + this.adminUsername = adminUsername; + return this; + } + + /** + * Get the adminPassword property: Gets or sets administrator password. + * + * @return the adminPassword value. + */ + public String adminPassword() { + return this.adminPassword; + } + + /** + * Set the adminPassword property: Gets or sets administrator password. + * + * @param adminPassword the adminPassword value to set. + * @return the OsProfile object itself. + */ + public OsProfile withAdminPassword(String adminPassword) { + this.adminPassword = adminPassword; + return this; + } + + /** + * Get the osType property: Gets or sets the type of the os. + * + * @return the osType value. + */ + public OsType osType() { + return this.osType; + } + + /** + * Set the osType property: Gets or sets the type of the os. + * + * @param osType the osType value to set. + * @return the OsProfile object itself. + */ + public OsProfile withOsType(OsType osType) { + this.osType = osType; + return this; + } + + /** + * Get the osName property: Gets or sets os name. + * + * @return the osName value. + */ + public String osName() { + return this.osName; + } + + /** + * Get the toolsRunningStatus property: Gets or sets the current running status of VMware Tools running in the guest + * operating system. + * + * @return the toolsRunningStatus value. + */ + public String toolsRunningStatus() { + return this.toolsRunningStatus; + } + + /** + * Get the toolsVersionStatus property: Gets or sets the current version status of VMware Tools installed in the + * guest operating system. + * + * @return the toolsVersionStatus value. + */ + public String toolsVersionStatus() { + return this.toolsVersionStatus; + } + + /** + * Get the toolsVersion property: Gets or sets the current version of VMware Tools. + * + * @return the toolsVersion value. + */ + public String toolsVersion() { + return this.toolsVersion; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/OsType.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/OsType.java new file mode 100644 index 000000000000..bdb233316b4e --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/OsType.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.connectedvmware.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); + } + + /** + * Gets known OsType values. + * + * @return known OsType values. + */ + public static Collection values() { + return values(OsType.class); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/PlacementProfile.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/PlacementProfile.java new file mode 100644 index 000000000000..16ef6fd822dd --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/PlacementProfile.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the resource properties. */ +@Fluent +public final class PlacementProfile { + /* + * Gets or sets the ARM Id of the resourcePool resource on which this + * virtual machine will deploy. + */ + @JsonProperty(value = "resourcePoolId") + private String resourcePoolId; + + /* + * Gets or sets the ARM Id of the cluster resource on which this virtual + * machine will deploy. + */ + @JsonProperty(value = "clusterId") + private String clusterId; + + /* + * Gets or sets the ARM Id of the host resource on which this virtual + * machine will deploy. + */ + @JsonProperty(value = "hostId") + private String hostId; + + /* + * Gets or sets the ARM Id of the datastore resource on which the data for + * the virtual machine will be kept. + */ + @JsonProperty(value = "datastoreId") + private String datastoreId; + + /** + * Get the resourcePoolId property: Gets or sets the ARM Id of the resourcePool resource on which this virtual + * machine will deploy. + * + * @return the resourcePoolId value. + */ + public String resourcePoolId() { + return this.resourcePoolId; + } + + /** + * Set the resourcePoolId property: Gets or sets the ARM Id of the resourcePool resource on which this virtual + * machine will deploy. + * + * @param resourcePoolId the resourcePoolId value to set. + * @return the PlacementProfile object itself. + */ + public PlacementProfile withResourcePoolId(String resourcePoolId) { + this.resourcePoolId = resourcePoolId; + return this; + } + + /** + * Get the clusterId property: Gets or sets the ARM Id of the cluster resource on which this virtual machine will + * deploy. + * + * @return the clusterId value. + */ + public String clusterId() { + return this.clusterId; + } + + /** + * Set the clusterId property: Gets or sets the ARM Id of the cluster resource on which this virtual machine will + * deploy. + * + * @param clusterId the clusterId value to set. + * @return the PlacementProfile object itself. + */ + public PlacementProfile withClusterId(String clusterId) { + this.clusterId = clusterId; + return this; + } + + /** + * Get the hostId property: Gets or sets the ARM Id of the host resource on which this virtual machine will deploy. + * + * @return the hostId value. + */ + public String hostId() { + return this.hostId; + } + + /** + * Set the hostId property: Gets or sets the ARM Id of the host resource on which this virtual machine will deploy. + * + * @param hostId the hostId value to set. + * @return the PlacementProfile object itself. + */ + public PlacementProfile withHostId(String hostId) { + this.hostId = hostId; + return this; + } + + /** + * Get the datastoreId property: Gets or sets the ARM Id of the datastore resource on which the data for the virtual + * machine will be kept. + * + * @return the datastoreId value. + */ + public String datastoreId() { + return this.datastoreId; + } + + /** + * Set the datastoreId property: Gets or sets the ARM Id of the datastore resource on which the data for the virtual + * machine will be kept. + * + * @param datastoreId the datastoreId value to set. + * @return the PlacementProfile object itself. + */ + public PlacementProfile withDatastoreId(String datastoreId) { + this.datastoreId = datastoreId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/PowerOnBootOption.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/PowerOnBootOption.java new file mode 100644 index 000000000000..fd2aab259061 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/PowerOnBootOption.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.connectedvmware.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PowerOnBootOption. */ +public final class PowerOnBootOption extends ExpandableStringEnum { + /** Static value enabled for PowerOnBootOption. */ + public static final PowerOnBootOption ENABLED = fromString("enabled"); + + /** Static value disabled for PowerOnBootOption. */ + public static final PowerOnBootOption DISABLED = fromString("disabled"); + + /** + * Creates or finds a PowerOnBootOption from its string representation. + * + * @param name a name to look for. + * @return the corresponding PowerOnBootOption. + */ + @JsonCreator + public static PowerOnBootOption fromString(String name) { + return fromString(name, PowerOnBootOption.class); + } + + /** + * Gets known PowerOnBootOption values. + * + * @return known PowerOnBootOption values. + */ + public static Collection values() { + return values(PowerOnBootOption.class); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ProvisioningAction.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ProvisioningAction.java new file mode 100644 index 000000000000..5c1f168aabce --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ProvisioningAction.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.connectedvmware.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningAction. */ +public final class ProvisioningAction extends ExpandableStringEnum { + /** Static value install for ProvisioningAction. */ + public static final ProvisioningAction INSTALL = fromString("install"); + + /** Static value uninstall for ProvisioningAction. */ + public static final ProvisioningAction UNINSTALL = fromString("uninstall"); + + /** Static value repair for ProvisioningAction. */ + public static final ProvisioningAction REPAIR = fromString("repair"); + + /** + * Creates or finds a ProvisioningAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningAction. + */ + @JsonCreator + public static ProvisioningAction fromString(String name) { + return fromString(name, ProvisioningAction.class); + } + + /** + * Gets known ProvisioningAction values. + * + * @return known ProvisioningAction values. + */ + public static Collection values() { + return values(ProvisioningAction.class); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ProvisioningState.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ProvisioningState.java new file mode 100644 index 000000000000..2ab4a87b70e3 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ProvisioningState.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** Static value Provisioning for ProvisioningState. */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** Static value Updating for ProvisioningState. */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Accepted for ProvisioningState. */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** Static value Created for ProvisioningState. */ + public static final ProvisioningState CREATED = fromString("Created"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ResourcePatch.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ResourcePatch.java new file mode 100644 index 000000000000..219ac919e656 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.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 updates for patch operations. */ +@Fluent +public 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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ResourcePool.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ResourcePool.java new file mode 100644 index 000000000000..ff056e5d8447 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ResourcePool.java @@ -0,0 +1,383 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.fluent.models.ResourcePoolInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of ResourcePool. */ +public interface ResourcePool { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the extendedLocation property: Gets or sets the extended location. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * 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 uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + String uuid(); + + /** + * Gets the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this resource pool resides. + * + * @return the vCenterId value. + */ + String vCenterId(); + + /** + * Gets the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the resource pool. + * + * @return the moRefId value. + */ + String moRefId(); + + /** + * Gets the inventoryItemId property: Gets or sets the inventory Item ID for the resource pool. + * + * @return the inventoryItemId value. + */ + String inventoryItemId(); + + /** + * Gets the moName property: Gets or sets the vCenter Managed Object name for the resource pool. + * + * @return the moName value. + */ + String moName(); + + /** + * Gets the cpuSharesLevel property: Gets or sets CPUSharesLevel which specifies the CPU allocation level for this + * pool. This property is used in relative allocation between resource consumers. + * + * @return the cpuSharesLevel value. + */ + String cpuSharesLevel(); + + /** + * Gets the cpuReservationMHz property: Gets or sets CPUReservationMHz which specifies the CPU size in MHz that is + * guaranteed to be available. + * + * @return the cpuReservationMHz value. + */ + Long cpuReservationMHz(); + + /** + * Gets the cpuLimitMHz property: Gets or sets CPULimitMHz which specifies a CPU usage limit in MHz. Utilization + * will not exceed this limit even if there are available resources. + * + * @return the cpuLimitMHz value. + */ + Long cpuLimitMHz(); + + /** + * Gets the memSharesLevel property: Gets or sets CPUSharesLevel which specifies the memory allocation level for + * this pool. This property is used in relative allocation between resource consumers. + * + * @return the memSharesLevel value. + */ + String memSharesLevel(); + + /** + * Gets the memReservationMB property: Gets or sets MemReservationMB which specifies the guaranteed available memory + * in megabytes. + * + * @return the memReservationMB value. + */ + Long memReservationMB(); + + /** + * Gets the memLimitMB property: Gets or sets MemLimitMB specifies a memory usage limit in megabytes. Utilization + * will not exceed the specified limit even if there are available resources. + * + * @return the memLimitMB value. + */ + Long memLimitMB(); + + /** + * Gets the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + String customResourceName(); + + /** + * Gets the statuses property: The resource status information. + * + * @return the statuses value. + */ + List statuses(); + + /** + * 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.connectedvmware.fluent.models.ResourcePoolInner object. + * + * @return the inner object. + */ + ResourcePoolInner innerModel(); + + /** The entirety of the ResourcePool definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The ResourcePool definition stages. */ + interface DefinitionStages { + /** The first stage of the ResourcePool definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ResourcePool 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 ResourcePool definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The Resource Group Name. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the ResourcePool 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.WithKind, + DefinitionStages.WithVCenterId, + DefinitionStages.WithMoRefId, + DefinitionStages.WithInventoryItemId { + /** + * Executes the create request. + * + * @return the created resource. + */ + ResourcePool create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ResourcePool create(Context context); + } + /** The stage of the ResourcePool 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 ResourcePool definition allowing to specify extendedLocation. */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: Gets or sets the extended location.. + * + * @param extendedLocation Gets or sets the extended location. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + /** The stage of the ResourcePool 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); + } + /** The stage of the ResourcePool definition allowing to specify vCenterId. */ + interface WithVCenterId { + /** + * Specifies the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this resource + * pool resides.. + * + * @param vCenterId Gets or sets the ARM Id of the vCenter resource in which this resource pool resides. + * @return the next definition stage. + */ + WithCreate withVCenterId(String vCenterId); + } + /** The stage of the ResourcePool definition allowing to specify moRefId. */ + interface WithMoRefId { + /** + * Specifies the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the + * resource pool.. + * + * @param moRefId Gets or sets the vCenter MoRef (Managed Object Reference) ID for the resource pool. + * @return the next definition stage. + */ + WithCreate withMoRefId(String moRefId); + } + /** The stage of the ResourcePool definition allowing to specify inventoryItemId. */ + interface WithInventoryItemId { + /** + * Specifies the inventoryItemId property: Gets or sets the inventory Item ID for the resource pool.. + * + * @param inventoryItemId Gets or sets the inventory Item ID for the resource pool. + * @return the next definition stage. + */ + WithCreate withInventoryItemId(String inventoryItemId); + } + } + /** + * Begins update for the ResourcePool resource. + * + * @return the stage of resource update. + */ + ResourcePool.Update update(); + + /** The template for ResourcePool update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ResourcePool apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ResourcePool apply(Context context); + } + /** The ResourcePool update stages. */ + interface UpdateStages { + /** The stage of the ResourcePool 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. + */ + ResourcePool refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ResourcePool refresh(Context context); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ResourcePoolInventoryItem.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ResourcePoolInventoryItem.java new file mode 100644 index 000000000000..9ab151f1186f --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ResourcePoolInventoryItem.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.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.fluent.models.InventoryItemProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The resource pool inventory item. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "inventoryType") +@JsonTypeName("ResourcePool") +@Fluent +public final class ResourcePoolInventoryItem extends InventoryItemProperties { + /* + * Parent resourcePool inventory resource details. + */ + @JsonProperty(value = "parent") + private InventoryItemDetails parent; + + /** + * Get the parent property: Parent resourcePool inventory resource details. + * + * @return the parent value. + */ + public InventoryItemDetails parent() { + return this.parent; + } + + /** + * Set the parent property: Parent resourcePool inventory resource details. + * + * @param parent the parent value to set. + * @return the ResourcePoolInventoryItem object itself. + */ + public ResourcePoolInventoryItem withParent(InventoryItemDetails parent) { + this.parent = parent; + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourcePoolInventoryItem withManagedResourceId(String managedResourceId) { + super.withManagedResourceId(managedResourceId); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourcePoolInventoryItem withMoRefId(String moRefId) { + super.withMoRefId(moRefId); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourcePoolInventoryItem withMoName(String moName) { + super.withMoName(moName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (parent() != null) { + parent().validate(); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ResourcePools.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ResourcePools.java new file mode 100644 index 000000000000..b050f17d9696 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ResourcePools.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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 ResourcePools. */ +public interface ResourcePools { + /** + * Implements resourcePool GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the resourcePool. + */ + ResourcePool getByResourceGroup(String resourceGroupName, String resourcePoolName); + + /** + * Implements resourcePool GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the resourcePool along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String resourcePoolName, Context context); + + /** + * Implements resourcePool DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 resourcePoolName, Boolean force); + + /** + * Implements resourcePool DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 resourcePoolName); + + /** + * Implements resourcePool DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param resourcePoolName Name of the resourcePool. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 resourcePoolName, Boolean force, Context context); + + /** + * List of resourcePools 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 ResourcePools as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List of resourcePools 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 ResourcePools as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List of resourcePools in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 ResourcePools as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of resourcePools in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 ResourcePools as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Implements resourcePool 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 define the resourcePool along with {@link Response}. + */ + ResourcePool getById(String id); + + /** + * Implements resourcePool 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 define the resourcePool along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Implements resourcePool DELETE 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. + */ + void deleteById(String id); + + /** + * Implements resourcePool DELETE method. + * + * @param id the resource ID. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 ResourcePool resource. + * + * @param name resource name. + * @return the first stage of the new ResourcePool definition. + */ + ResourcePool.DefinitionStages.Blank define(String name); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ResourcePoolsList.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ResourcePoolsList.java new file mode 100644 index 000000000000..76f36b8d609b --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ResourcePoolsList.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.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.connectedvmware.fluent.models.ResourcePoolInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of ResourcePools. */ +@Fluent +public final class ResourcePoolsList { + /* + * Url to follow for getting next page of ResourcePools. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * Array of ResourcePools + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the nextLink property: Url to follow for getting next page of ResourcePools. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to follow for getting next page of ResourcePools. + * + * @param nextLink the nextLink value to set. + * @return the ResourcePoolsList object itself. + */ + public ResourcePoolsList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: Array of ResourcePools. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of ResourcePools. + * + * @param value the value value to set. + * @return the ResourcePoolsList object itself. + */ + public ResourcePoolsList 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 ResourcePoolsList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ResourcePoolsList.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ResourceStatus.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ResourceStatus.java new file mode 100644 index 000000000000..4a4db2c1d243 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ResourceStatus.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The resource status information. */ +@Immutable +public final class ResourceStatus { + /* + * The type of the condition. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Status of the condition. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * The reason for the condition's status. + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private String reason; + + /* + * A human readable message indicating details about the status. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /* + * Severity with which to treat failures of this type of condition. + */ + @JsonProperty(value = "severity", access = JsonProperty.Access.WRITE_ONLY) + private String severity; + + /* + * The last update time for this condition. + */ + @JsonProperty(value = "lastUpdatedAt", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdatedAt; + + /** + * Get the type property: The type of the condition. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the status property: Status of the condition. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the reason property: The reason for the condition's status. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Get the message property: A human readable message indicating details about the status. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Get the severity property: Severity with which to treat failures of this type of condition. + * + * @return the severity value. + */ + public String severity() { + return this.severity; + } + + /** + * Get the lastUpdatedAt property: The last update time for this condition. + * + * @return the lastUpdatedAt value. + */ + public OffsetDateTime lastUpdatedAt() { + return this.lastUpdatedAt; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ScsiControllerType.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ScsiControllerType.java new file mode 100644 index 000000000000..d2978cfd4dc2 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/ScsiControllerType.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.connectedvmware.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ScsiControllerType. */ +public final class ScsiControllerType extends ExpandableStringEnum { + /** Static value lsilogic for ScsiControllerType. */ + public static final ScsiControllerType LSILOGIC = fromString("lsilogic"); + + /** Static value buslogic for ScsiControllerType. */ + public static final ScsiControllerType BUSLOGIC = fromString("buslogic"); + + /** Static value pvscsi for ScsiControllerType. */ + public static final ScsiControllerType PVSCSI = fromString("pvscsi"); + + /** Static value lsilogicsas for ScsiControllerType. */ + public static final ScsiControllerType LSILOGICSAS = fromString("lsilogicsas"); + + /** + * Creates or finds a ScsiControllerType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ScsiControllerType. + */ + @JsonCreator + public static ScsiControllerType fromString(String name) { + return fromString(name, ScsiControllerType.class); + } + + /** + * Gets known ScsiControllerType values. + * + * @return known ScsiControllerType values. + */ + public static Collection values() { + return values(ScsiControllerType.class); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/StatusLevelTypes.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/StatusLevelTypes.java new file mode 100644 index 000000000000..5ef8640b54ef --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/StatusLevelTypes.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.connectedvmware.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for StatusLevelTypes. */ +public final class StatusLevelTypes extends ExpandableStringEnum { + /** Static value Info for StatusLevelTypes. */ + public static final StatusLevelTypes INFO = fromString("Info"); + + /** Static value Warning for StatusLevelTypes. */ + public static final StatusLevelTypes WARNING = fromString("Warning"); + + /** Static value Error for StatusLevelTypes. */ + public static final StatusLevelTypes ERROR = fromString("Error"); + + /** + * Creates or finds a StatusLevelTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding StatusLevelTypes. + */ + @JsonCreator + public static StatusLevelTypes fromString(String name) { + return fromString(name, StatusLevelTypes.class); + } + + /** + * Gets known StatusLevelTypes values. + * + * @return known StatusLevelTypes values. + */ + public static Collection values() { + return values(StatusLevelTypes.class); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/StatusTypes.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/StatusTypes.java new file mode 100644 index 000000000000..ce0146622c31 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/StatusTypes.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.connectedvmware.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for StatusTypes. */ +public final class StatusTypes extends ExpandableStringEnum { + /** Static value Connected for StatusTypes. */ + public static final StatusTypes CONNECTED = fromString("Connected"); + + /** Static value Disconnected for StatusTypes. */ + public static final StatusTypes DISCONNECTED = fromString("Disconnected"); + + /** Static value Error for StatusTypes. */ + public static final StatusTypes ERROR = fromString("Error"); + + /** + * Creates or finds a StatusTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding StatusTypes. + */ + @JsonCreator + public static StatusTypes fromString(String name) { + return fromString(name, StatusTypes.class); + } + + /** + * Gets known StatusTypes values. + * + * @return known StatusTypes values. + */ + public static Collection values() { + return values(StatusTypes.class); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/StopVirtualMachineOptions.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/StopVirtualMachineOptions.java new file mode 100644 index 000000000000..c04f4a9eb7f3 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/StorageProfile.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/StorageProfile.java new file mode 100644 index 000000000000..1a44a523f9cf --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/StorageProfile.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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; + + /* + * Gets or sets the list of virtual SCSI controllers associated with the + * virtual machine. + */ + @JsonProperty(value = "scsiControllers", access = JsonProperty.Access.WRITE_ONLY) + private List scsiControllers; + + /** + * 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; + } + + /** + * Get the scsiControllers property: Gets or sets the list of virtual SCSI controllers associated with the virtual + * machine. + * + * @return the scsiControllers value. + */ + public List scsiControllers() { + return this.scsiControllers; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (disks() != null) { + disks().forEach(e -> e.validate()); + } + if (scsiControllers() != null) { + scsiControllers().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/StorageProfileUpdate.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/StorageProfileUpdate.java new file mode 100644 index 000000000000..f82e5e13f2ef --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Defines the resource update 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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VCenter.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VCenter.java new file mode 100644 index 000000000000..43369f0634a3 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VCenter.java @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.fluent.models.VCenterInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of VCenter. */ +public interface VCenter { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the extendedLocation property: Gets or sets the extended location. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * 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 uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + String uuid(); + + /** + * Gets the fqdn property: Gets or sets the FQDN/IPAddress of the vCenter. + * + * @return the fqdn value. + */ + String fqdn(); + + /** + * Gets the port property: Gets or sets the port of the vCenter. + * + * @return the port value. + */ + Integer port(); + + /** + * Gets the version property: Gets or sets the version of the vCenter. + * + * @return the version value. + */ + String version(); + + /** + * Gets the instanceUuid property: Gets or sets the instance UUID of the vCenter. + * + * @return the instanceUuid value. + */ + String instanceUuid(); + + /** + * Gets the connectionStatus property: Gets or sets the connection status to the vCenter. + * + * @return the connectionStatus value. + */ + String connectionStatus(); + + /** + * Gets the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + String customResourceName(); + + /** + * Gets the credentials property: Username / Password Credentials to connect to vcenter. + * + * @return the credentials value. + */ + VICredential credentials(); + + /** + * Gets the statuses property: The resource status information. + * + * @return the statuses value. + */ + List statuses(); + + /** + * 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.connectedvmware.fluent.models.VCenterInner object. + * + * @return the inner object. + */ + VCenterInner innerModel(); + + /** The entirety of the VCenter definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithFqdn, + DefinitionStages.WithCreate { + } + /** The VCenter definition stages. */ + interface DefinitionStages { + /** The first stage of the VCenter definition. */ + interface Blank extends WithLocation { + } + /** The stage of the VCenter 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 VCenter definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The Resource Group Name. + * @return the next definition stage. + */ + WithFqdn withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the VCenter definition allowing to specify fqdn. */ + interface WithFqdn { + /** + * Specifies the fqdn property: Gets or sets the FQDN/IPAddress of the vCenter.. + * + * @param fqdn Gets or sets the FQDN/IPAddress of the vCenter. + * @return the next definition stage. + */ + WithCreate withFqdn(String fqdn); + } + /** + * The stage of the VCenter 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.WithKind, + DefinitionStages.WithPort, + DefinitionStages.WithCredentials { + /** + * Executes the create request. + * + * @return the created resource. + */ + VCenter create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + VCenter create(Context context); + } + /** The stage of the VCenter 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 VCenter definition allowing to specify extendedLocation. */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: Gets or sets the extended location.. + * + * @param extendedLocation Gets or sets the extended location. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + /** The stage of the VCenter 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); + } + /** The stage of the VCenter definition allowing to specify port. */ + interface WithPort { + /** + * Specifies the port property: Gets or sets the port of the vCenter.. + * + * @param port Gets or sets the port of the vCenter. + * @return the next definition stage. + */ + WithCreate withPort(Integer port); + } + /** The stage of the VCenter definition allowing to specify credentials. */ + interface WithCredentials { + /** + * Specifies the credentials property: Username / Password Credentials to connect to vcenter.. + * + * @param credentials Username / Password Credentials to connect to vcenter. + * @return the next definition stage. + */ + WithCreate withCredentials(VICredential credentials); + } + } + /** + * Begins update for the VCenter resource. + * + * @return the stage of resource update. + */ + VCenter.Update update(); + + /** The template for VCenter update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + VCenter apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + VCenter apply(Context context); + } + /** The VCenter update stages. */ + interface UpdateStages { + /** The stage of the VCenter 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. + */ + VCenter refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + VCenter refresh(Context context); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VCenters.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VCenters.java new file mode 100644 index 000000000000..b0c11e2bdc7f --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VCenters.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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 VCenters. */ +public interface VCenters { + /** + * Implements vCenter GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 vCenter. + */ + VCenter getByResourceGroup(String resourceGroupName, String vcenterName); + + /** + * Implements vCenter GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 vCenter along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String vcenterName, Context context); + + /** + * Implements vCenter DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 vcenterName, Boolean force); + + /** + * Implements vCenter DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 vcenterName); + + /** + * Implements vCenter DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param vcenterName Name of the vCenter. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 vcenterName, Boolean force, Context context); + + /** + * List of vCenters 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 VCenters as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List of vCenters 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 VCenters as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List of vCenters in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 VCenters as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List of vCenters in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 VCenters as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Implements vCenter 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 defines the vCenter along with {@link Response}. + */ + VCenter getById(String id); + + /** + * Implements vCenter 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 defines the vCenter along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Implements vCenter DELETE 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. + */ + void deleteById(String id); + + /** + * Implements vCenter DELETE method. + * + * @param id the resource ID. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 VCenter resource. + * + * @param name resource name. + * @return the first stage of the new VCenter definition. + */ + VCenter.DefinitionStages.Blank define(String name); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VCentersList.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VCentersList.java new file mode 100644 index 000000000000..1e012f4753d5 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VCentersList.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.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.connectedvmware.fluent.models.VCenterInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of VCenters. */ +@Fluent +public final class VCentersList { + /* + * Url to follow for getting next page of VCenters. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * Array of VCenters + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the nextLink property: Url to follow for getting next page of VCenters. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to follow for getting next page of VCenters. + * + * @param nextLink the nextLink value to set. + * @return the VCentersList object itself. + */ + public VCentersList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: Array of VCenters. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of VCenters. + * + * @param value the value value to set. + * @return the VCentersList object itself. + */ + public VCentersList 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 VCentersList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VCentersList.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VICredential.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VICredential.java new file mode 100644 index 000000000000..3cdc03a69cba --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VICredential.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.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Username / Password Credentials to connect to vcenter. */ +@Fluent +public final class VICredential { + /* + * Gets or sets username to connect with the vCenter. + */ + @JsonProperty(value = "username") + private String username; + + /* + * Gets or sets the password to connect with the vCenter. + */ + @JsonProperty(value = "password") + private String password; + + /** + * Get the username property: Gets or sets username to connect with the vCenter. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: Gets or sets username to connect with the vCenter. + * + * @param username the username value to set. + * @return the VICredential object itself. + */ + public VICredential withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: Gets or sets the password to connect with the vCenter. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: Gets or sets the password to connect with the vCenter. + * + * @param password the password value to set. + * @return the VICredential object itself. + */ + public VICredential 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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualDisk.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualDisk.java new file mode 100644 index 000000000000..a8ac5ebb3903 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualDisk.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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 virtual disk. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Gets or sets the label of the virtual disk in vCenter. + */ + @JsonProperty(value = "label", access = JsonProperty.Access.WRITE_ONLY) + private String label; + + /* + * Gets or sets the disk object id. + */ + @JsonProperty(value = "diskObjectId", access = JsonProperty.Access.WRITE_ONLY) + private String diskObjectId; + + /* + * Gets or sets the disk total size. + */ + @JsonProperty(value = "diskSizeGB") + private Integer diskSizeGB; + + /* + * Gets or sets the device key value. + */ + @JsonProperty(value = "deviceKey") + private Integer deviceKey; + + /* + * Gets or sets the disk mode. + */ + @JsonProperty(value = "diskMode") + private DiskMode diskMode; + + /* + * Gets or sets the controller id. + */ + @JsonProperty(value = "controllerKey") + private Integer controllerKey; + + /* + * Gets or sets the unit number of the disk on the controller. + */ + @JsonProperty(value = "unitNumber") + private Integer unitNumber; + + /* + * Gets or sets the device name. + */ + @JsonProperty(value = "deviceName") + private String deviceName; + + /* + * Gets or sets the disk backing type. + */ + @JsonProperty(value = "diskType") + private DiskType diskType; + + /** + * Get the name property: Gets or sets the name of the virtual disk. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets or sets the name of the virtual 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 label property: Gets or sets the label of the virtual disk in vCenter. + * + * @return the label value. + */ + public String label() { + return this.label; + } + + /** + * Get the diskObjectId property: Gets or sets the disk object id. + * + * @return the diskObjectId value. + */ + public String diskObjectId() { + return this.diskObjectId; + } + + /** + * 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 deviceKey property: Gets or sets the device key value. + * + * @return the deviceKey value. + */ + public Integer deviceKey() { + return this.deviceKey; + } + + /** + * Set the deviceKey property: Gets or sets the device key value. + * + * @param deviceKey the deviceKey value to set. + * @return the VirtualDisk object itself. + */ + public VirtualDisk withDeviceKey(Integer deviceKey) { + this.deviceKey = deviceKey; + return this; + } + + /** + * Get the diskMode property: Gets or sets the disk mode. + * + * @return the diskMode value. + */ + public DiskMode diskMode() { + return this.diskMode; + } + + /** + * Set the diskMode property: Gets or sets the disk mode. + * + * @param diskMode the diskMode value to set. + * @return the VirtualDisk object itself. + */ + public VirtualDisk withDiskMode(DiskMode diskMode) { + this.diskMode = diskMode; + return this; + } + + /** + * Get the controllerKey property: Gets or sets the controller id. + * + * @return the controllerKey value. + */ + public Integer controllerKey() { + return this.controllerKey; + } + + /** + * Set the controllerKey property: Gets or sets the controller id. + * + * @param controllerKey the controllerKey value to set. + * @return the VirtualDisk object itself. + */ + public VirtualDisk withControllerKey(Integer controllerKey) { + this.controllerKey = controllerKey; + return this; + } + + /** + * Get the unitNumber property: Gets or sets the unit number of the disk on the controller. + * + * @return the unitNumber value. + */ + public Integer unitNumber() { + return this.unitNumber; + } + + /** + * Set the unitNumber property: Gets or sets the unit number of the disk on the controller. + * + * @param unitNumber the unitNumber value to set. + * @return the VirtualDisk object itself. + */ + public VirtualDisk withUnitNumber(Integer unitNumber) { + this.unitNumber = unitNumber; + return this; + } + + /** + * Get the deviceName property: Gets or sets the device name. + * + * @return the deviceName value. + */ + public String deviceName() { + return this.deviceName; + } + + /** + * Set the deviceName property: Gets or sets the device name. + * + * @param deviceName the deviceName value to set. + * @return the VirtualDisk object itself. + */ + public VirtualDisk withDeviceName(String deviceName) { + this.deviceName = deviceName; + return this; + } + + /** + * Get the diskType property: Gets or sets the disk backing type. + * + * @return the diskType value. + */ + public DiskType diskType() { + return this.diskType; + } + + /** + * Set the diskType property: Gets or sets the disk backing type. + * + * @param diskType the diskType value to set. + * @return the VirtualDisk object itself. + */ + public VirtualDisk withDiskType(DiskType diskType) { + this.diskType = diskType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualDiskUpdate.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualDiskUpdate.java new file mode 100644 index 000000000000..aebdf04966ae --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualDiskUpdate.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the virtual disk update. */ +@Fluent +public final class VirtualDiskUpdate { + /* + * Gets or sets the name of the virtual disk. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Gets or sets the disk total size. + */ + @JsonProperty(value = "diskSizeGB") + private Integer diskSizeGB; + + /* + * Gets or sets the device key value. + */ + @JsonProperty(value = "deviceKey") + private Integer deviceKey; + + /* + * Gets or sets the disk mode. + */ + @JsonProperty(value = "diskMode") + private DiskMode diskMode; + + /* + * Gets or sets the controller id. + */ + @JsonProperty(value = "controllerKey") + private Integer controllerKey; + + /* + * Gets or sets the unit number of the disk on the controller. + */ + @JsonProperty(value = "unitNumber") + private Integer unitNumber; + + /* + * Gets or sets the device name. + */ + @JsonProperty(value = "deviceName") + private String deviceName; + + /* + * Gets or sets the disk backing type. + */ + @JsonProperty(value = "diskType") + private DiskType diskType; + + /** + * Get the name property: Gets or sets the name of the virtual disk. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets or sets the name of the virtual 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 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 deviceKey property: Gets or sets the device key value. + * + * @return the deviceKey value. + */ + public Integer deviceKey() { + return this.deviceKey; + } + + /** + * Set the deviceKey property: Gets or sets the device key value. + * + * @param deviceKey the deviceKey value to set. + * @return the VirtualDiskUpdate object itself. + */ + public VirtualDiskUpdate withDeviceKey(Integer deviceKey) { + this.deviceKey = deviceKey; + return this; + } + + /** + * Get the diskMode property: Gets or sets the disk mode. + * + * @return the diskMode value. + */ + public DiskMode diskMode() { + return this.diskMode; + } + + /** + * Set the diskMode property: Gets or sets the disk mode. + * + * @param diskMode the diskMode value to set. + * @return the VirtualDiskUpdate object itself. + */ + public VirtualDiskUpdate withDiskMode(DiskMode diskMode) { + this.diskMode = diskMode; + return this; + } + + /** + * Get the controllerKey property: Gets or sets the controller id. + * + * @return the controllerKey value. + */ + public Integer controllerKey() { + return this.controllerKey; + } + + /** + * Set the controllerKey property: Gets or sets the controller id. + * + * @param controllerKey the controllerKey value to set. + * @return the VirtualDiskUpdate object itself. + */ + public VirtualDiskUpdate withControllerKey(Integer controllerKey) { + this.controllerKey = controllerKey; + return this; + } + + /** + * Get the unitNumber property: Gets or sets the unit number of the disk on the controller. + * + * @return the unitNumber value. + */ + public Integer unitNumber() { + return this.unitNumber; + } + + /** + * Set the unitNumber property: Gets or sets the unit number of the disk on the controller. + * + * @param unitNumber the unitNumber value to set. + * @return the VirtualDiskUpdate object itself. + */ + public VirtualDiskUpdate withUnitNumber(Integer unitNumber) { + this.unitNumber = unitNumber; + return this; + } + + /** + * Get the deviceName property: Gets or sets the device name. + * + * @return the deviceName value. + */ + public String deviceName() { + return this.deviceName; + } + + /** + * Set the deviceName property: Gets or sets the device name. + * + * @param deviceName the deviceName value to set. + * @return the VirtualDiskUpdate object itself. + */ + public VirtualDiskUpdate withDeviceName(String deviceName) { + this.deviceName = deviceName; + return this; + } + + /** + * Get the diskType property: Gets or sets the disk backing type. + * + * @return the diskType value. + */ + public DiskType diskType() { + return this.diskType; + } + + /** + * Set the diskType property: Gets or sets the disk backing type. + * + * @param diskType the diskType value to set. + * @return the VirtualDiskUpdate object itself. + */ + public VirtualDiskUpdate withDiskType(DiskType diskType) { + this.diskType = diskType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachine.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachine.java new file mode 100644 index 000000000000..14f08c0ea174 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachine.java @@ -0,0 +1,675 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.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 extendedLocation property: Gets or sets the extended location. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * 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 identity property: The identity of the resource. + * + * @return the identity value. + */ + Identity identity(); + + /** + * Gets the resourcePoolId property: Gets or sets the ARM Id of the resourcePool resource on which this virtual + * machine will deploy. + * + * @return the resourcePoolId value. + */ + String resourcePoolId(); + + /** + * Gets the templateId property: Gets or sets the ARM Id of the template resource to deploy the virtual machine. + * + * @return the templateId value. + */ + String templateId(); + + /** + * Gets the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this resource pool resides. + * + * @return the vCenterId value. + */ + String vCenterId(); + + /** + * Gets the placementProfile property: Placement properties. + * + * @return the placementProfile value. + */ + PlacementProfile placementProfile(); + + /** + * 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 guestAgentProfile property: Guest agent status properties. + * + * @return the guestAgentProfile value. + */ + GuestAgentProfile guestAgentProfile(); + + /** + * Gets the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual machine. + * + * @return the moRefId value. + */ + String moRefId(); + + /** + * Gets the inventoryItemId property: Gets or sets the inventory Item ID for the virtual machine. + * + * @return the inventoryItemId value. + */ + String inventoryItemId(); + + /** + * Gets the moName property: Gets or sets the vCenter Managed Object name for the virtual machine. + * + * @return the moName value. + */ + String moName(); + + /** + * Gets the folderPath property: Gets or sets the folder path of the vm. + * + * @return the folderPath value. + */ + String folderPath(); + + /** + * Gets the instanceUuid property: Gets or sets the instance uuid of the vm. + * + * @return the instanceUuid value. + */ + String instanceUuid(); + + /** + * Gets the smbiosUuid property: Gets or sets the SMBIOS UUID of the vm. + * + * @return the smbiosUuid value. + */ + String smbiosUuid(); + + /** + * Gets the firmwareType property: Firmware type. + * + * @return the firmwareType value. + */ + FirmwareType firmwareType(); + + /** + * Gets the powerState property: Gets the power state of the virtual machine. + * + * @return the powerState value. + */ + String powerState(); + + /** + * Gets the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + String customResourceName(); + + /** + * Gets the uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + String uuid(); + + /** + * Gets the statuses property: The resource status information. + * + * @return the statuses value. + */ + List statuses(); + + /** + * Gets the provisioningState property: Gets or sets the provisioning state. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the vmId property: Gets or sets a unique identifier for the vm resource. + * + * @return the vmId value. + */ + String vmId(); + + /** + * 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.connectedvmware.fluent.models.VirtualMachineInner object. + * + * @return the inner object. + */ + VirtualMachineInner innerModel(); + + /** The entirety of the VirtualMachine definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The VirtualMachine definition stages. */ + interface DefinitionStages { + /** The first stage of the VirtualMachine definition. */ + interface Blank extends WithLocation { + } + /** The stage of the VirtualMachine definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the VirtualMachine definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The Resource Group Name. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the VirtualMachine definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithExtendedLocation, + DefinitionStages.WithKind, + DefinitionStages.WithIdentity, + DefinitionStages.WithResourcePoolId, + DefinitionStages.WithTemplateId, + DefinitionStages.WithVCenterId, + DefinitionStages.WithPlacementProfile, + DefinitionStages.WithOsProfile, + DefinitionStages.WithHardwareProfile, + DefinitionStages.WithNetworkProfile, + DefinitionStages.WithStorageProfile, + DefinitionStages.WithGuestAgentProfile, + DefinitionStages.WithMoRefId, + DefinitionStages.WithInventoryItemId, + DefinitionStages.WithSmbiosUuid, + DefinitionStages.WithFirmwareType { + /** + * 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 extendedLocation. */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: Gets or sets the extended location.. + * + * @param extendedLocation Gets or sets the extended location. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + /** The stage of the VirtualMachine 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); + } + /** The stage of the VirtualMachine definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the resource.. + * + * @param identity The identity of the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(Identity identity); + } + /** The stage of the VirtualMachine definition allowing to specify resourcePoolId. */ + interface WithResourcePoolId { + /** + * Specifies the resourcePoolId property: Gets or sets the ARM Id of the resourcePool resource on which this + * virtual machine will deploy.. + * + * @param resourcePoolId Gets or sets the ARM Id of the resourcePool resource on which this virtual machine + * will deploy. + * @return the next definition stage. + */ + WithCreate withResourcePoolId(String resourcePoolId); + } + /** The stage of the VirtualMachine definition allowing to specify templateId. */ + interface WithTemplateId { + /** + * Specifies the templateId property: Gets or sets the ARM Id of the template resource to deploy the virtual + * machine.. + * + * @param templateId Gets or sets the ARM Id of the template resource to deploy the virtual machine. + * @return the next definition stage. + */ + WithCreate withTemplateId(String templateId); + } + /** The stage of the VirtualMachine definition allowing to specify vCenterId. */ + interface WithVCenterId { + /** + * Specifies the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this resource + * pool resides.. + * + * @param vCenterId Gets or sets the ARM Id of the vCenter resource in which this resource pool resides. + * @return the next definition stage. + */ + WithCreate withVCenterId(String vCenterId); + } + /** The stage of the VirtualMachine definition allowing to specify placementProfile. */ + interface WithPlacementProfile { + /** + * Specifies the placementProfile property: Placement properties.. + * + * @param placementProfile Placement properties. + * @return the next definition stage. + */ + WithCreate withPlacementProfile(PlacementProfile placementProfile); + } + /** 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 guestAgentProfile. */ + interface WithGuestAgentProfile { + /** + * Specifies the guestAgentProfile property: Guest agent status properties.. + * + * @param guestAgentProfile Guest agent status properties. + * @return the next definition stage. + */ + WithCreate withGuestAgentProfile(GuestAgentProfile guestAgentProfile); + } + /** The stage of the VirtualMachine definition allowing to specify moRefId. */ + interface WithMoRefId { + /** + * Specifies the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the + * virtual machine.. + * + * @param moRefId Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual machine. + * @return the next definition stage. + */ + WithCreate withMoRefId(String moRefId); + } + /** 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 virtual machine.. + * + * @param inventoryItemId Gets or sets the inventory Item ID for the virtual machine. + * @return the next definition stage. + */ + WithCreate withInventoryItemId(String inventoryItemId); + } + /** The stage of the VirtualMachine definition allowing to specify smbiosUuid. */ + interface WithSmbiosUuid { + /** + * Specifies the smbiosUuid property: Gets or sets the SMBIOS UUID of the vm.. + * + * @param smbiosUuid Gets or sets the SMBIOS UUID of the vm. + * @return the next definition stage. + */ + WithCreate withSmbiosUuid(String smbiosUuid); + } + /** The stage of the VirtualMachine definition allowing to specify firmwareType. */ + interface WithFirmwareType { + /** + * Specifies the firmwareType property: Firmware type. + * + * @param firmwareType Firmware type. + * @return the next definition stage. + */ + WithCreate withFirmwareType(FirmwareType firmwareType); + } + } + /** + * 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.WithIdentity, + UpdateStages.WithHardwareProfile, + UpdateStages.WithStorageProfile, + UpdateStages.WithNetworkProfile { + /** + * 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 identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the resource.. + * + * @param identity The identity of the resource. + * @return the next definition stage. + */ + Update withIdentity(Identity identity); + } + /** The stage of the VirtualMachine update allowing to specify hardwareProfile. */ + interface WithHardwareProfile { + /** + * Specifies the hardwareProfile property: Defines the resource properties.. + * + * @param hardwareProfile Defines the resource properties. + * @return the next definition stage. + */ + Update withHardwareProfile(HardwareProfile hardwareProfile); + } + /** The stage of the VirtualMachine update allowing to specify storageProfile. */ + interface WithStorageProfile { + /** + * Specifies the storageProfile property: Defines the resource update properties.. + * + * @param storageProfile Defines the resource update properties. + * @return the next definition stage. + */ + Update withStorageProfile(StorageProfileUpdate storageProfile); + } + /** The stage of the VirtualMachine update allowing to specify networkProfile. */ + interface WithNetworkProfile { + /** + * Specifies the networkProfile property: Defines the update resource properties.. + * + * @param networkProfile Defines the update resource properties. + * @return the next definition stage. + */ + Update withNetworkProfile(NetworkProfileUpdate networkProfile); + } + } + /** + * 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); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachineInventoryItem.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachineInventoryItem.java new file mode 100644 index 000000000000..2b0d61570ef7 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachineInventoryItem.java @@ -0,0 +1,327 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.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 VM 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") + private OsType osType; + + /* + * Gets or sets os name. + */ + @JsonProperty(value = "osName") + private String osName; + + /* + * Gets or sets the nic ip addresses. + */ + @JsonProperty(value = "ipAddresses") + private List ipAddresses; + + /* + * Gets or sets the folder path of the vm. + */ + @JsonProperty(value = "folderPath") + private String folderPath; + + /* + * Host inventory resource details. + */ + @JsonProperty(value = "host") + private InventoryItemDetails host; + + /* + * ResourcePool inventory resource details. + */ + @JsonProperty(value = "resourcePool") + private InventoryItemDetails resourcePool; + + /* + * Gets or sets the instance uuid of the vm. + */ + @JsonProperty(value = "instanceUuid") + private String instanceUuid; + + /* + * Gets or sets the SMBIOS UUID of the vm. + */ + @JsonProperty(value = "smbiosUuid") + private String smbiosUuid; + + /* + * Gets the power state of the virtual machine. + */ + @JsonProperty(value = "powerState", access = JsonProperty.Access.WRITE_ONLY) + private String powerState; + + /* + * Gets or sets the current running status of VMware Tools running in the + * guest operating system. + */ + @JsonProperty(value = "toolsRunningStatus", access = JsonProperty.Access.WRITE_ONLY) + private String toolsRunningStatus; + + /* + * Gets or sets the current version status of VMware Tools installed in the + * guest operating system. + */ + @JsonProperty(value = "toolsVersionStatus", access = JsonProperty.Access.WRITE_ONLY) + private String toolsVersionStatus; + + /* + * Gets or sets the current version of VMware Tools. + */ + @JsonProperty(value = "toolsVersion", access = JsonProperty.Access.WRITE_ONLY) + private String toolsVersion; + + /** + * Get the osType property: Gets or sets the type of the os. + * + * @return the osType value. + */ + public OsType osType() { + return this.osType; + } + + /** + * Set the osType property: Gets or sets the type of the os. + * + * @param osType the osType value to set. + * @return the VirtualMachineInventoryItem object itself. + */ + public VirtualMachineInventoryItem withOsType(OsType osType) { + this.osType = osType; + return this; + } + + /** + * Get the osName property: Gets or sets os name. + * + * @return the osName value. + */ + public String osName() { + return this.osName; + } + + /** + * Set the osName property: Gets or sets os name. + * + * @param osName the osName value to set. + * @return the VirtualMachineInventoryItem object itself. + */ + public VirtualMachineInventoryItem withOsName(String osName) { + this.osName = osName; + return this; + } + + /** + * 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 folderPath property: Gets or sets the folder path of the vm. + * + * @return the folderPath value. + */ + public String folderPath() { + return this.folderPath; + } + + /** + * Set the folderPath property: Gets or sets the folder path of the vm. + * + * @param folderPath the folderPath value to set. + * @return the VirtualMachineInventoryItem object itself. + */ + public VirtualMachineInventoryItem withFolderPath(String folderPath) { + this.folderPath = folderPath; + return this; + } + + /** + * Get the host property: Host inventory resource details. + * + * @return the host value. + */ + public InventoryItemDetails host() { + return this.host; + } + + /** + * Set the host property: Host inventory resource details. + * + * @param host the host value to set. + * @return the VirtualMachineInventoryItem object itself. + */ + public VirtualMachineInventoryItem withHost(InventoryItemDetails host) { + this.host = host; + return this; + } + + /** + * Get the resourcePool property: ResourcePool inventory resource details. + * + * @return the resourcePool value. + */ + public InventoryItemDetails resourcePool() { + return this.resourcePool; + } + + /** + * Set the resourcePool property: ResourcePool inventory resource details. + * + * @param resourcePool the resourcePool value to set. + * @return the VirtualMachineInventoryItem object itself. + */ + public VirtualMachineInventoryItem withResourcePool(InventoryItemDetails resourcePool) { + this.resourcePool = resourcePool; + return this; + } + + /** + * Get the instanceUuid property: Gets or sets the instance uuid of the vm. + * + * @return the instanceUuid value. + */ + public String instanceUuid() { + return this.instanceUuid; + } + + /** + * Set the instanceUuid property: Gets or sets the instance uuid of the vm. + * + * @param instanceUuid the instanceUuid value to set. + * @return the VirtualMachineInventoryItem object itself. + */ + public VirtualMachineInventoryItem withInstanceUuid(String instanceUuid) { + this.instanceUuid = instanceUuid; + return this; + } + + /** + * Get the smbiosUuid property: Gets or sets the SMBIOS UUID of the vm. + * + * @return the smbiosUuid value. + */ + public String smbiosUuid() { + return this.smbiosUuid; + } + + /** + * Set the smbiosUuid property: Gets or sets the SMBIOS UUID of the vm. + * + * @param smbiosUuid the smbiosUuid value to set. + * @return the VirtualMachineInventoryItem object itself. + */ + public VirtualMachineInventoryItem withSmbiosUuid(String smbiosUuid) { + this.smbiosUuid = smbiosUuid; + 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 toolsRunningStatus property: Gets or sets the current running status of VMware Tools running in the guest + * operating system. + * + * @return the toolsRunningStatus value. + */ + public String toolsRunningStatus() { + return this.toolsRunningStatus; + } + + /** + * Get the toolsVersionStatus property: Gets or sets the current version status of VMware Tools installed in the + * guest operating system. + * + * @return the toolsVersionStatus value. + */ + public String toolsVersionStatus() { + return this.toolsVersionStatus; + } + + /** + * Get the toolsVersion property: Gets or sets the current version of VMware Tools. + * + * @return the toolsVersion value. + */ + public String toolsVersion() { + return this.toolsVersion; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineInventoryItem withManagedResourceId(String managedResourceId) { + super.withManagedResourceId(managedResourceId); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineInventoryItem withMoRefId(String moRefId) { + super.withMoRefId(moRefId); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineInventoryItem withMoName(String moName) { + super.withMoName(moName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (host() != null) { + host().validate(); + } + if (resourcePool() != null) { + resourcePool().validate(); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachineTemplate.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachineTemplate.java new file mode 100644 index 000000000000..8a607ce94676 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachineTemplate.java @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.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 extendedLocation property: Gets or sets the extended location. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * 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 uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + String uuid(); + + /** + * Gets the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this template resides. + * + * @return the vCenterId value. + */ + String vCenterId(); + + /** + * Gets the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual machine + * template. + * + * @return the moRefId value. + */ + String moRefId(); + + /** + * Gets the inventoryItemId property: Gets or sets the inventory Item ID for the virtual machine template. + * + * @return the inventoryItemId value. + */ + String inventoryItemId(); + + /** + * Gets the moName property: Gets or sets the vCenter Managed Object name for the virtual machine template. + * + * @return the moName value. + */ + String moName(); + + /** + * Gets the memorySizeMB property: Gets or sets memory size in MBs for the template. + * + * @return the memorySizeMB value. + */ + Integer memorySizeMB(); + + /** + * Gets the numCPUs property: Gets or sets the number of vCPUs for the template. + * + * @return the numCPUs value. + */ + Integer numCPUs(); + + /** + * Gets the numCoresPerSocket property: Gets or sets the number of cores per socket for the template. Defaults to 1 + * if unspecified. + * + * @return the numCoresPerSocket value. + */ + Integer numCoresPerSocket(); + + /** + * 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 folderPath property: Gets or sets the folder path of the template. + * + * @return the folderPath value. + */ + String folderPath(); + + /** + * 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 the template. + * + * @return the disks value. + */ + List disks(); + + /** + * Gets the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + String customResourceName(); + + /** + * Gets the toolsVersionStatus property: Gets or sets the current version status of VMware Tools installed in the + * guest operating system. + * + * @return the toolsVersionStatus value. + */ + String toolsVersionStatus(); + + /** + * Gets the toolsVersion property: Gets or sets the current version of VMware Tools. + * + * @return the toolsVersion value. + */ + String toolsVersion(); + + /** + * Gets the firmwareType property: Firmware type. + * + * @return the firmwareType value. + */ + FirmwareType firmwareType(); + + /** + * Gets the statuses property: The resource status information. + * + * @return the statuses value. + */ + List statuses(); + + /** + * 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.connectedvmware.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.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 Resource Group Name. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * 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.WithExtendedLocation, + DefinitionStages.WithKind, + DefinitionStages.WithVCenterId, + DefinitionStages.WithMoRefId, + DefinitionStages.WithInventoryItemId { + /** + * 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 extendedLocation. */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: Gets or sets the extended location.. + * + * @param extendedLocation Gets or sets the extended location. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + /** The stage of the VirtualMachineTemplate 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); + } + /** The stage of the VirtualMachineTemplate definition allowing to specify vCenterId. */ + interface WithVCenterId { + /** + * Specifies the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this template + * resides.. + * + * @param vCenterId Gets or sets the ARM Id of the vCenter resource in which this template resides. + * @return the next definition stage. + */ + WithCreate withVCenterId(String vCenterId); + } + /** The stage of the VirtualMachineTemplate definition allowing to specify moRefId. */ + interface WithMoRefId { + /** + * Specifies the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the + * virtual machine template.. + * + * @param moRefId Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual machine + * template. + * @return the next definition stage. + */ + WithCreate withMoRefId(String moRefId); + } + /** 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 virtual machine + * template.. + * + * @param inventoryItemId Gets or sets the inventory Item ID for the virtual machine template. + * @return the next definition stage. + */ + WithCreate withInventoryItemId(String inventoryItemId); + } + } + /** + * 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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachineTemplateInventoryItem.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachineTemplateInventoryItem.java new file mode 100644 index 000000000000..f60534bb896c --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachineTemplateInventoryItem.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.fluent.models.InventoryItemProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The VM Template inventory item. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "inventoryType") +@JsonTypeName("VirtualMachineTemplate") +@Fluent +public final class VirtualMachineTemplateInventoryItem extends InventoryItemProperties { + /* + * Gets or sets memory size in MBs for the template. + */ + @JsonProperty(value = "memorySizeMB") + private Integer memorySizeMB; + + /* + * Gets or sets the number of vCPUs for the template. + */ + @JsonProperty(value = "numCPUs") + private Integer numCPUs; + + /* + * Gets or sets the number of cores per socket for the template. + * Defaults to 1 if unspecified. + */ + @JsonProperty(value = "numCoresPerSocket") + private Integer numCoresPerSocket; + + /* + * Gets or sets the type of the os. + */ + @JsonProperty(value = "osType") + private OsType osType; + + /* + * Gets or sets os name. + */ + @JsonProperty(value = "osName") + private String osName; + + /* + * Gets or sets the folder path of the template. + */ + @JsonProperty(value = "folderPath") + private String folderPath; + + /** + * Get the memorySizeMB property: Gets or sets memory size in MBs for the template. + * + * @return the memorySizeMB value. + */ + public Integer memorySizeMB() { + return this.memorySizeMB; + } + + /** + * Set the memorySizeMB property: Gets or sets memory size in MBs for the template. + * + * @param memorySizeMB the memorySizeMB value to set. + * @return the VirtualMachineTemplateInventoryItem object itself. + */ + public VirtualMachineTemplateInventoryItem withMemorySizeMB(Integer memorySizeMB) { + this.memorySizeMB = memorySizeMB; + return this; + } + + /** + * Get the numCPUs property: Gets or sets the number of vCPUs for the template. + * + * @return the numCPUs value. + */ + public Integer numCPUs() { + return this.numCPUs; + } + + /** + * Set the numCPUs property: Gets or sets the number of vCPUs for the template. + * + * @param numCPUs the numCPUs value to set. + * @return the VirtualMachineTemplateInventoryItem object itself. + */ + public VirtualMachineTemplateInventoryItem withNumCPUs(Integer numCPUs) { + this.numCPUs = numCPUs; + return this; + } + + /** + * Get the numCoresPerSocket property: Gets or sets the number of cores per socket for the template. Defaults to 1 + * if unspecified. + * + * @return the numCoresPerSocket value. + */ + public Integer numCoresPerSocket() { + return this.numCoresPerSocket; + } + + /** + * Set the numCoresPerSocket property: Gets or sets the number of cores per socket for the template. Defaults to 1 + * if unspecified. + * + * @param numCoresPerSocket the numCoresPerSocket value to set. + * @return the VirtualMachineTemplateInventoryItem object itself. + */ + public VirtualMachineTemplateInventoryItem withNumCoresPerSocket(Integer numCoresPerSocket) { + this.numCoresPerSocket = numCoresPerSocket; + return this; + } + + /** + * Get the osType property: Gets or sets the type of the os. + * + * @return the osType value. + */ + public OsType osType() { + return this.osType; + } + + /** + * Set the osType property: Gets or sets the type of the os. + * + * @param osType the osType value to set. + * @return the VirtualMachineTemplateInventoryItem object itself. + */ + public VirtualMachineTemplateInventoryItem withOsType(OsType osType) { + this.osType = osType; + return this; + } + + /** + * Get the osName property: Gets or sets os name. + * + * @return the osName value. + */ + public String osName() { + return this.osName; + } + + /** + * Set the osName property: Gets or sets os name. + * + * @param osName the osName value to set. + * @return the VirtualMachineTemplateInventoryItem object itself. + */ + public VirtualMachineTemplateInventoryItem withOsName(String osName) { + this.osName = osName; + return this; + } + + /** + * Get the folderPath property: Gets or sets the folder path of the template. + * + * @return the folderPath value. + */ + public String folderPath() { + return this.folderPath; + } + + /** + * Set the folderPath property: Gets or sets the folder path of the template. + * + * @param folderPath the folderPath value to set. + * @return the VirtualMachineTemplateInventoryItem object itself. + */ + public VirtualMachineTemplateInventoryItem withFolderPath(String folderPath) { + this.folderPath = folderPath; + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineTemplateInventoryItem withManagedResourceId(String managedResourceId) { + super.withManagedResourceId(managedResourceId); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineTemplateInventoryItem withMoRefId(String moRefId) { + super.withMoRefId(moRefId); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualMachineTemplateInventoryItem withMoName(String moName) { + super.withMoName(moName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachineTemplates.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachineTemplates.java new file mode 100644 index 000000000000..1907b4e993fb --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachineTemplates.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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 virtual machine template GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachineTemplate. + */ + VirtualMachineTemplate getByResourceGroup(String resourceGroupName, String virtualMachineTemplateName); + + /** + * Implements virtual machine template GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachineTemplate along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualMachineTemplateName, Context context); + + /** + * Implements virtual machine template DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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); + + /** + * Implements virtual machine template DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String virtualMachineTemplateName); + + /** + * Implements virtual machine template DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineTemplateName Name of the virtual machine template resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 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); + + /** + * List of virtualMachineTemplates in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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); + + /** + * Implements virtual machine template 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 define the virtualMachineTemplate along with {@link Response}. + */ + VirtualMachineTemplate getById(String id); + + /** + * Implements virtual machine template 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 define the virtualMachineTemplate along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Implements virtual machine template DELETE 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. + */ + void deleteById(String id); + + /** + * Implements virtual machine template DELETE method. + * + * @param id the resource ID. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachineTemplatesList.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachineTemplatesList.java new file mode 100644 index 000000000000..5fbe692ff0b4 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachineTemplatesList.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.connectedvmware.fluent.models.VirtualMachineTemplateInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of VirtualMachineTemplates. */ +@Fluent +public final class VirtualMachineTemplatesList { + /* + * Url to follow for getting next page of VirtualMachineTemplates. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * Array of VirtualMachineTemplates + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the nextLink property: Url to follow for getting next page of VirtualMachineTemplates. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to follow for getting next page of VirtualMachineTemplates. + * + * @param nextLink the nextLink value to set. + * @return the VirtualMachineTemplatesList object itself. + */ + public VirtualMachineTemplatesList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: Array of VirtualMachineTemplates. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of VirtualMachineTemplates. + * + * @param value the value value to set. + * @return the VirtualMachineTemplatesList object itself. + */ + public VirtualMachineTemplatesList 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 VirtualMachineTemplatesList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualMachineTemplatesList.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachineUpdate.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachineUpdate.java new file mode 100644 index 000000000000..3c4f65b90fc8 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachineUpdate.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.fluent.models.VirtualMachineUpdateProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Defines the virtualMachineUpdate. */ +@Fluent +public final class VirtualMachineUpdate { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private VirtualMachineUpdateProperties innerProperties; + + /* + * Gets or sets the Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The identity of the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private VirtualMachineUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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; + } + + /** + * Get the identity property: The identity of the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the resource. + * + * @param identity the identity value to set. + * @return the VirtualMachineUpdate object itself. + */ + public VirtualMachineUpdate withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** + * Get the hardwareProfile property: Defines the resource properties. + * + * @return the hardwareProfile value. + */ + public HardwareProfile hardwareProfile() { + return this.innerProperties() == null ? null : this.innerProperties().hardwareProfile(); + } + + /** + * Set the hardwareProfile property: Defines the resource properties. + * + * @param hardwareProfile the hardwareProfile value to set. + * @return the VirtualMachineUpdate object itself. + */ + public VirtualMachineUpdate withHardwareProfile(HardwareProfile hardwareProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineUpdateProperties(); + } + this.innerProperties().withHardwareProfile(hardwareProfile); + return this; + } + + /** + * Get the storageProfile property: Defines the resource update properties. + * + * @return the storageProfile value. + */ + public StorageProfileUpdate storageProfile() { + return this.innerProperties() == null ? null : this.innerProperties().storageProfile(); + } + + /** + * Set the storageProfile property: Defines the resource update properties. + * + * @param storageProfile the storageProfile value to set. + * @return the VirtualMachineUpdate object itself. + */ + public VirtualMachineUpdate withStorageProfile(StorageProfileUpdate storageProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineUpdateProperties(); + } + this.innerProperties().withStorageProfile(storageProfile); + return this; + } + + /** + * Get the networkProfile property: Defines the update resource properties. + * + * @return the networkProfile value. + */ + public NetworkProfileUpdate networkProfile() { + return this.innerProperties() == null ? null : this.innerProperties().networkProfile(); + } + + /** + * Set the networkProfile property: Defines the update resource properties. + * + * @param networkProfile the networkProfile value to set. + * @return the VirtualMachineUpdate object itself. + */ + public VirtualMachineUpdate withNetworkProfile(NetworkProfileUpdate networkProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualMachineUpdateProperties(); + } + this.innerProperties().withNetworkProfile(networkProfile); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachines.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachines.java new file mode 100644 index 000000000000..a75064ff84c1 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachines.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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 virtual machine GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine. + */ + VirtualMachine getByResourceGroup(String resourceGroupName, String virtualMachineName); + + /** + * Implements virtual machine GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualMachine along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualMachineName, Context context); + + /** + * Implements virtual machine DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 force); + + /** + * Implements virtual machine DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String virtualMachineName); + + /** + * Implements virtual machine DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 force, Context context); + + /** + * Stop virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stop(String resourceGroupName, String virtualMachineName); + + /** + * Stop virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @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 Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(String resourceGroupName, String virtualMachineName); + + /** + * Start virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(String resourceGroupName, String virtualMachineName, Context context); + + /** + * Restart virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(String resourceGroupName, String virtualMachineName); + + /** + * Restart virtual machine. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualMachineName Name of the virtual machine resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(String resourceGroupName, String virtualMachineName, 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); + + /** + * List of virtualMachines in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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); + + /** + * Implements virtual machine 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 define the virtualMachine along with {@link Response}. + */ + VirtualMachine getById(String id); + + /** + * Implements virtual machine 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 define the virtualMachine along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Implements virtual machine DELETE 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. + */ + void deleteById(String id); + + /** + * Implements virtual machine DELETE method. + * + * @param id the resource ID. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachinesList.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachinesList.java new file mode 100644 index 000000000000..f4a2c62cab09 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualMachinesList.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.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.connectedvmware.fluent.models.VirtualMachineInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of VirtualMachines. */ +@Fluent +public final class VirtualMachinesList { + /* + * Url to follow for getting next page of VirtualMachines. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * Array of VirtualMachines + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the nextLink property: Url to follow for getting next page of VirtualMachines. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to follow for getting next page of VirtualMachines. + * + * @param nextLink the nextLink value to set. + * @return the VirtualMachinesList object itself. + */ + public VirtualMachinesList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: Array of VirtualMachines. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of VirtualMachines. + * + * @param value the value value to set. + * @return the VirtualMachinesList object itself. + */ + public VirtualMachinesList 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 VirtualMachinesList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualMachinesList.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualNetwork.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualNetwork.java new file mode 100644 index 000000000000..d9a3793cfe41 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualNetwork.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.fluent.models.VirtualNetworkInner; +import java.util.List; +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 extendedLocation property: Gets or sets the extended location. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * 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 uuid property: Gets or sets a unique identifier for this resource. + * + * @return the uuid value. + */ + String uuid(); + + /** + * Gets the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this template resides. + * + * @return the vCenterId value. + */ + String vCenterId(); + + /** + * Gets the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual network. + * + * @return the moRefId value. + */ + String moRefId(); + + /** + * Gets the inventoryItemId property: Gets or sets the inventory Item ID for the virtual network. + * + * @return the inventoryItemId value. + */ + String inventoryItemId(); + + /** + * Gets the moName property: Gets or sets the vCenter Managed Object name for the virtual network. + * + * @return the moName value. + */ + String moName(); + + /** + * Gets the customResourceName property: Gets the name of the corresponding resource in Kubernetes. + * + * @return the customResourceName value. + */ + String customResourceName(); + + /** + * Gets the statuses property: The resource status information. + * + * @return the statuses value. + */ + List statuses(); + + /** + * 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.connectedvmware.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.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 Resource Group Name. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * 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.WithExtendedLocation, + DefinitionStages.WithKind, + DefinitionStages.WithVCenterId, + DefinitionStages.WithMoRefId, + DefinitionStages.WithInventoryItemId { + /** + * 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 extendedLocation. */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: Gets or sets the extended location.. + * + * @param extendedLocation Gets or sets the extended location. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + /** The stage of the VirtualNetwork 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); + } + /** The stage of the VirtualNetwork definition allowing to specify vCenterId. */ + interface WithVCenterId { + /** + * Specifies the vCenterId property: Gets or sets the ARM Id of the vCenter resource in which this template + * resides.. + * + * @param vCenterId Gets or sets the ARM Id of the vCenter resource in which this template resides. + * @return the next definition stage. + */ + WithCreate withVCenterId(String vCenterId); + } + /** The stage of the VirtualNetwork definition allowing to specify moRefId. */ + interface WithMoRefId { + /** + * Specifies the moRefId property: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the + * virtual network.. + * + * @param moRefId Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual network. + * @return the next definition stage. + */ + WithCreate withMoRefId(String moRefId); + } + /** 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 virtual network.. + * + * @param inventoryItemId Gets or sets the inventory Item ID for the virtual network. + * @return the next definition stage. + */ + WithCreate withInventoryItemId(String inventoryItemId); + } + } + /** + * 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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualNetworkInventoryItem.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualNetworkInventoryItem.java new file mode 100644 index 000000000000..d4229d242851 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualNetworkInventoryItem.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.connectedvmware.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") +@Fluent +public final class VirtualNetworkInventoryItem extends InventoryItemProperties { + /** {@inheritDoc} */ + @Override + public VirtualNetworkInventoryItem withManagedResourceId(String managedResourceId) { + super.withManagedResourceId(managedResourceId); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualNetworkInventoryItem withMoRefId(String moRefId) { + super.withMoRefId(moRefId); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualNetworkInventoryItem withMoName(String moName) { + super.withMoName(moName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualNetworks.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualNetworks.java new file mode 100644 index 000000000000..77c7316d947c --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualNetworks.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.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 virtual network GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualNetwork. + */ + VirtualNetwork getByResourceGroup(String resourceGroupName, String virtualNetworkName); + + /** + * Implements virtual network GET method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define the virtualNetwork along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualNetworkName, Context context); + + /** + * Implements virtual network DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param force Whether force delete was specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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); + + /** + * Implements virtual network DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String virtualNetworkName); + + /** + * Implements virtual network DELETE method. + * + * @param resourceGroupName The Resource Group Name. + * @param virtualNetworkName Name of the virtual network resource. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 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); + + /** + * List of virtualNetworks in a resource group. + * + * @param resourceGroupName The Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Resource Group Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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); + + /** + * Implements virtual network 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 define the virtualNetwork along with {@link Response}. + */ + VirtualNetwork getById(String id); + + /** + * Implements virtual network 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 define the virtualNetwork along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Implements virtual network DELETE 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. + */ + void deleteById(String id); + + /** + * Implements virtual network DELETE method. + * + * @param id the resource ID. + * @param force Whether force delete was specified. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualNetworksList.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualNetworksList.java new file mode 100644 index 000000000000..eed80eaaa6de --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualNetworksList.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.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.connectedvmware.fluent.models.VirtualNetworkInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of VirtualNetworks. */ +@Fluent +public final class VirtualNetworksList { + /* + * Url to follow for getting next page of VirtualNetworks. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * Array of VirtualNetworks + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the nextLink property: Url to follow for getting next page of VirtualNetworks. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to follow for getting next page of VirtualNetworks. + * + * @param nextLink the nextLink value to set. + * @return the VirtualNetworksList object itself. + */ + public VirtualNetworksList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: Array of VirtualNetworks. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of VirtualNetworks. + * + * @param value the value value to set. + * @return the VirtualNetworksList object itself. + */ + public VirtualNetworksList 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 VirtualNetworksList")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualNetworksList.class); +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualScsiController.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualScsiController.java new file mode 100644 index 000000000000..2adf836a99dc --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualScsiController.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * This data object type contains the properties of a SCSI controller device attached to a virtual machine that is + * reported by the controller. + */ +@Fluent +public final class VirtualScsiController { + /* + * Gets or sets the controller type. + */ + @JsonProperty(value = "type") + private ScsiControllerType type; + + /* + * Gets or sets the key of the controller. + */ + @JsonProperty(value = "controllerKey") + private Integer controllerKey; + + /* + * Gets or sets the bus number of the controller. + */ + @JsonProperty(value = "busNumber") + private Integer busNumber; + + /* + * Gets or sets the SCSI controller unit number. + */ + @JsonProperty(value = "scsiCtlrUnitNumber") + private Integer scsiCtlrUnitNumber; + + /* + * Gets or sets the sharing mode. + */ + @JsonProperty(value = "sharing") + private VirtualScsiSharing sharing; + + /** + * Get the type property: Gets or sets the controller type. + * + * @return the type value. + */ + public ScsiControllerType type() { + return this.type; + } + + /** + * Set the type property: Gets or sets the controller type. + * + * @param type the type value to set. + * @return the VirtualScsiController object itself. + */ + public VirtualScsiController withType(ScsiControllerType type) { + this.type = type; + return this; + } + + /** + * Get the controllerKey property: Gets or sets the key of the controller. + * + * @return the controllerKey value. + */ + public Integer controllerKey() { + return this.controllerKey; + } + + /** + * Set the controllerKey property: Gets or sets the key of the controller. + * + * @param controllerKey the controllerKey value to set. + * @return the VirtualScsiController object itself. + */ + public VirtualScsiController withControllerKey(Integer controllerKey) { + this.controllerKey = controllerKey; + return this; + } + + /** + * Get the busNumber property: Gets or sets the bus number of the controller. + * + * @return the busNumber value. + */ + public Integer busNumber() { + return this.busNumber; + } + + /** + * Set the busNumber property: Gets or sets the bus number of the controller. + * + * @param busNumber the busNumber value to set. + * @return the VirtualScsiController object itself. + */ + public VirtualScsiController withBusNumber(Integer busNumber) { + this.busNumber = busNumber; + return this; + } + + /** + * Get the scsiCtlrUnitNumber property: Gets or sets the SCSI controller unit number. + * + * @return the scsiCtlrUnitNumber value. + */ + public Integer scsiCtlrUnitNumber() { + return this.scsiCtlrUnitNumber; + } + + /** + * Set the scsiCtlrUnitNumber property: Gets or sets the SCSI controller unit number. + * + * @param scsiCtlrUnitNumber the scsiCtlrUnitNumber value to set. + * @return the VirtualScsiController object itself. + */ + public VirtualScsiController withScsiCtlrUnitNumber(Integer scsiCtlrUnitNumber) { + this.scsiCtlrUnitNumber = scsiCtlrUnitNumber; + return this; + } + + /** + * Get the sharing property: Gets or sets the sharing mode. + * + * @return the sharing value. + */ + public VirtualScsiSharing sharing() { + return this.sharing; + } + + /** + * Set the sharing property: Gets or sets the sharing mode. + * + * @param sharing the sharing value to set. + * @return the VirtualScsiController object itself. + */ + public VirtualScsiController withSharing(VirtualScsiSharing sharing) { + this.sharing = sharing; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualScsiSharing.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualScsiSharing.java new file mode 100644 index 000000000000..5eddf3ec8682 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/VirtualScsiSharing.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.connectedvmware.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VirtualScsiSharing. */ +public final class VirtualScsiSharing extends ExpandableStringEnum { + /** Static value noSharing for VirtualScsiSharing. */ + public static final VirtualScsiSharing NO_SHARING = fromString("noSharing"); + + /** Static value physicalSharing for VirtualScsiSharing. */ + public static final VirtualScsiSharing PHYSICAL_SHARING = fromString("physicalSharing"); + + /** Static value virtualSharing for VirtualScsiSharing. */ + public static final VirtualScsiSharing VIRTUAL_SHARING = fromString("virtualSharing"); + + /** + * Creates or finds a VirtualScsiSharing from its string representation. + * + * @param name a name to look for. + * @return the corresponding VirtualScsiSharing. + */ + @JsonCreator + public static VirtualScsiSharing fromString(String name) { + return fromString(name, VirtualScsiSharing.class); + } + + /** + * Gets known VirtualScsiSharing values. + * + * @return known VirtualScsiSharing values. + */ + public static Collection values() { + return values(VirtualScsiSharing.class); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/package-info.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/models/package-info.java new file mode 100644 index 000000000000..f0645f87afbf --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/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 ConnectedVMwareClient. Connected VMware Client. */ +package com.azure.resourcemanager.connectedvmware.models; diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/package-info.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/package-info.java new file mode 100644 index 000000000000..d606de973f69 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/com/azure/resourcemanager/connectedvmware/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 ConnectedVMwareClient. Connected VMware Client. */ +package com.azure.resourcemanager.connectedvmware; diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/module-info.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/main/java/module-info.java new file mode 100644 index 000000000000..5c52f5241899 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/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.connectedvmware { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.connectedvmware; + exports com.azure.resourcemanager.connectedvmware.fluent; + exports com.azure.resourcemanager.connectedvmware.fluent.models; + exports com.azure.resourcemanager.connectedvmware.models; + + opens com.azure.resourcemanager.connectedvmware.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.connectedvmware.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ClustersCreateSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ClustersCreateSamples.java new file mode 100644 index 000000000000..ce94c66e12d7 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ClustersCreateSamples.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.connectedvmware.generated; + +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; + +/** Samples for Clusters Create. */ +public final class ClustersCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateCluster.json + */ + /** + * Sample code: CreateCluster. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createCluster(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager + .clusters() + .define("HRCluster") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso")) + .withVCenterId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter") + .withMoRefId("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .create(); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ClustersDeleteSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ClustersDeleteSamples.java new file mode 100644 index 000000000000..6c4181b56e3c --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ClustersDeleteSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for Clusters Delete. */ +public final class ClustersDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteCluster.json + */ + /** + * Sample code: DeleteCluster. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteCluster(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.clusters().delete("testrg", "HRCluster", null, Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ClustersGetByResourceGroupSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ClustersGetByResourceGroupSamples.java new file mode 100644 index 000000000000..7407d343dc60 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ClustersGetByResourceGroupSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for Clusters GetByResourceGroup. */ +public final class ClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetCluster.json + */ + /** + * Sample code: GetCluster. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getCluster(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.clusters().getByResourceGroupWithResponse("testrg", "HRCluster", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ClustersListByResourceGroupSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ClustersListByResourceGroupSamples.java new file mode 100644 index 000000000000..5b8cb4adf6fc --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ClustersListByResourceGroupSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for Clusters ListByResourceGroup. */ +public final class ClustersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListClustersByResourceGroup.json + */ + /** + * Sample code: ListClustersByResourceGroup. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listClustersByResourceGroup( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.clusters().listByResourceGroup("testrg", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ClustersListSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ClustersListSamples.java new file mode 100644 index 000000000000..1e9d75577196 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ClustersListSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for Clusters List. */ +public final class ClustersListSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListClusters.json + */ + /** + * Sample code: ListClusters. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listClusters(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.clusters().list(Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ClustersUpdateSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ClustersUpdateSamples.java new file mode 100644 index 000000000000..9e18ace56a7c --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ClustersUpdateSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.models.Cluster; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Clusters Update. */ +public final class ClustersUpdateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/UpdateCluster.json + */ + /** + * Sample code: UpdateCluster. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void updateCluster(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + Cluster resource = + manager.clusters().getByResourceGroupWithResponse("testrg", "HRCluster", 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/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/DatastoresCreateSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/DatastoresCreateSamples.java new file mode 100644 index 000000000000..86d32b6f1673 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/DatastoresCreateSamples.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.connectedvmware.generated; + +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; + +/** Samples for Datastores Create. */ +public final class DatastoresCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateDatastore.json + */ + /** + * Sample code: CreateDatastore. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createDatastore(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager + .datastores() + .define("HRDatastore") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso")) + .withVCenterId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter") + .withMoRefId("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .create(); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/DatastoresDeleteSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/DatastoresDeleteSamples.java new file mode 100644 index 000000000000..99a5bb6c27f7 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/DatastoresDeleteSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for Datastores Delete. */ +public final class DatastoresDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteDatastore.json + */ + /** + * Sample code: DeleteDatastore. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteDatastore(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.datastores().delete("testrg", "HRDatastore", null, Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/DatastoresGetByResourceGroupSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/DatastoresGetByResourceGroupSamples.java new file mode 100644 index 000000000000..382d8a45fcaa --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/DatastoresGetByResourceGroupSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for Datastores GetByResourceGroup. */ +public final class DatastoresGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetDatastore.json + */ + /** + * Sample code: GetDatastore. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getDatastore(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.datastores().getByResourceGroupWithResponse("testrg", "HRDatastore", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/DatastoresListByResourceGroupSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/DatastoresListByResourceGroupSamples.java new file mode 100644 index 000000000000..91cd663ff002 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/DatastoresListByResourceGroupSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for Datastores ListByResourceGroup. */ +public final class DatastoresListByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListDatastoresByResourceGroup.json + */ + /** + * Sample code: ListDatastoresByResourceGroup. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listDatastoresByResourceGroup( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.datastores().listByResourceGroup("testrg", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/DatastoresListSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/DatastoresListSamples.java new file mode 100644 index 000000000000..66580067e795 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/DatastoresListSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for Datastores List. */ +public final class DatastoresListSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListDatastores.json + */ + /** + * Sample code: ListDatastores. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listDatastores(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.datastores().list(Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/DatastoresUpdateSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/DatastoresUpdateSamples.java new file mode 100644 index 000000000000..1386b58d1245 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/DatastoresUpdateSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.models.Datastore; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Datastores Update. */ +public final class DatastoresUpdateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/UpdateDatastore.json + */ + /** + * Sample code: UpdateDatastore. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void updateDatastore(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + Datastore resource = + manager.datastores().getByResourceGroupWithResponse("testrg", "HRDatastore", 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/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/GuestAgentsCreateSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/GuestAgentsCreateSamples.java new file mode 100644 index 000000000000..61284dc53a5f --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/GuestAgentsCreateSamples.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.connectedvmware.generated; + +import com.azure.resourcemanager.connectedvmware.models.GuestCredential; +import com.azure.resourcemanager.connectedvmware.models.HttpProxyConfiguration; +import com.azure.resourcemanager.connectedvmware.models.ProvisioningAction; + +/** Samples for GuestAgents Create. */ +public final class GuestAgentsCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateGuestAgent.json + */ + /** + * Sample code: CreateGuestAgent. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createGuestAgent(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager + .guestAgents() + .define("default") + .withExistingVirtualMachine("testrg", "ContosoVm") + .withCredentials(new GuestCredential().withUsername("tempuser").withPassword("")) + .withHttpProxyConfig(new HttpProxyConfiguration().withHttpsProxy("http://192.1.2.3:8080")) + .withProvisioningAction(ProvisioningAction.INSTALL) + .create(); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/GuestAgentsDeleteSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/GuestAgentsDeleteSamples.java new file mode 100644 index 000000000000..f7e8f70ecc00 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/GuestAgentsDeleteSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for GuestAgents Delete. */ +public final class GuestAgentsDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteGuestAgent.json + */ + /** + * Sample code: DeleteGuestAgent. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteGuestAgent(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.guestAgents().delete("testrg", "ContosoVm", "default", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/GuestAgentsGetSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/GuestAgentsGetSamples.java new file mode 100644 index 000000000000..619ae97e8478 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/GuestAgentsGetSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for GuestAgents Get. */ +public final class GuestAgentsGetSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetGuestAgent.json + */ + /** + * Sample code: GetGuestAgent. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getGuestAgent(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.guestAgents().getWithResponse("testrg", "ContosoVm", "default", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/GuestAgentsListByVmSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/GuestAgentsListByVmSamples.java new file mode 100644 index 000000000000..4ff335cf9114 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/GuestAgentsListByVmSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for GuestAgents ListByVm. */ +public final class GuestAgentsListByVmSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GuestAgent_ListByVm.json + */ + /** + * Sample code: GuestAgentListByVm. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void guestAgentListByVm(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.guestAgents().listByVm("testrg", "ContosoVm", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HostsCreateSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HostsCreateSamples.java new file mode 100644 index 000000000000..d61afcce31e9 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HostsCreateSamples.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.connectedvmware.generated; + +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; + +/** Samples for Hosts Create. */ +public final class HostsCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateHost.json + */ + /** + * Sample code: CreateHost. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createHost(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager + .hosts() + .define("HRHost") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso")) + .withVCenterId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter") + .withMoRefId("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .create(); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HostsDeleteSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HostsDeleteSamples.java new file mode 100644 index 000000000000..01ea4932423f --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HostsDeleteSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for Hosts Delete. */ +public final class HostsDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteHost.json + */ + /** + * Sample code: DeleteHost. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteHost(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.hosts().delete("testrg", "HRHost", null, Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HostsGetByResourceGroupSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HostsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..264bdbd4393e --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HostsGetByResourceGroupSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for Hosts GetByResourceGroup. */ +public final class HostsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetHost.json + */ + /** + * Sample code: GetHost. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getHost(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.hosts().getByResourceGroupWithResponse("testrg", "HRHost", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HostsListByResourceGroupSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HostsListByResourceGroupSamples.java new file mode 100644 index 000000000000..f6d1cc1028ea --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HostsListByResourceGroupSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for Hosts ListByResourceGroup. */ +public final class HostsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListHostsByResourceGroup.json + */ + /** + * Sample code: ListHostsByResourceGroup. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listHostsByResourceGroup( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.hosts().listByResourceGroup("testrg", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HostsListSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HostsListSamples.java new file mode 100644 index 000000000000..c1e07ba30bd6 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HostsListSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for Hosts List. */ +public final class HostsListSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListHosts.json + */ + /** + * Sample code: ListHosts. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listHosts(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.hosts().list(Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HostsUpdateSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HostsUpdateSamples.java new file mode 100644 index 000000000000..de8dd9b202de --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HostsUpdateSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.models.HostModel; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Hosts Update. */ +public final class HostsUpdateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/UpdateHost.json + */ + /** + * Sample code: UpdateHost. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void updateHost(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + HostModel resource = + manager.hosts().getByResourceGroupWithResponse("testrg", "HRHost", 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/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HybridIdentityMetadataCreateSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HybridIdentityMetadataCreateSamples.java new file mode 100644 index 000000000000..65d62a55e73d --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HybridIdentityMetadataCreateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.generated; + +/** Samples for HybridIdentityMetadata Create. */ +public final class HybridIdentityMetadataCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateHybridIdentityMetadata.json + */ + /** + * Sample code: CreateHybridIdentityMetadata. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createHybridIdentityMetadata( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager + .hybridIdentityMetadatas() + .define("default") + .withExistingVirtualMachine("testrg", "ContosoVm") + .withVmId("f8b82dff-38ef-4220-99ef-d3a3f86ddc6c") + .withPublicKey("8ec7d60c-9700-40b1-8e6e-e5b2f6f477f2") + .create(); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HybridIdentityMetadataDeleteSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HybridIdentityMetadataDeleteSamples.java new file mode 100644 index 000000000000..113b42757114 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HybridIdentityMetadataDeleteSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for HybridIdentityMetadata Delete. */ +public final class HybridIdentityMetadataDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteHybridIdentityMetadata.json + */ + /** + * Sample code: DeleteHybridIdentityMetadata. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteHybridIdentityMetadata( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.hybridIdentityMetadatas().deleteWithResponse("testrg", "ContosoVm", "default", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HybridIdentityMetadataGetSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HybridIdentityMetadataGetSamples.java new file mode 100644 index 000000000000..e16d353733b5 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HybridIdentityMetadataGetSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for HybridIdentityMetadata Get. */ +public final class HybridIdentityMetadataGetSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetHybridIdentityMetadata.json + */ + /** + * Sample code: GetHybridIdentityMetadata. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getHybridIdentityMetadata( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.hybridIdentityMetadatas().getWithResponse("testrg", "ContosoVm", "default", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HybridIdentityMetadataListByVmSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HybridIdentityMetadataListByVmSamples.java new file mode 100644 index 000000000000..aa6422719f4b --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/HybridIdentityMetadataListByVmSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for HybridIdentityMetadata ListByVm. */ +public final class HybridIdentityMetadataListByVmSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/HybridIdentityMetadata_ListByVm.json + */ + /** + * Sample code: HybridIdentityMetadataListByVm. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void hybridIdentityMetadataListByVm( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.hybridIdentityMetadatas().listByVm("testrg", "ContosoVm", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/InventoryItemsCreateSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/InventoryItemsCreateSamples.java new file mode 100644 index 000000000000..d6b3cd2b50b4 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/InventoryItemsCreateSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.generated; + +/** Samples for InventoryItems Create. */ +public final class InventoryItemsCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateInventoryItem.json + */ + /** + * Sample code: CreateInventoryItem. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createInventoryItem(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.inventoryItems().define("testItem").withExistingVcenter("testrg", "ContosoVCenter").create(); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/InventoryItemsDeleteSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/InventoryItemsDeleteSamples.java new file mode 100644 index 000000000000..f23423eefba1 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/InventoryItemsDeleteSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for InventoryItems Delete. */ +public final class InventoryItemsDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteInventoryItem.json + */ + /** + * Sample code: DeleteInventoryItem. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteInventoryItem(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.inventoryItems().deleteWithResponse("testrg", "ContosoVCenter", "testItem", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/InventoryItemsGetSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/InventoryItemsGetSamples.java new file mode 100644 index 000000000000..de84132d6fc6 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/InventoryItemsGetSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for InventoryItems Get. */ +public final class InventoryItemsGetSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetInventoryItem.json + */ + /** + * Sample code: GetInventoryItem. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getInventoryItem(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.inventoryItems().getWithResponse("testrg", "ContosoVCenter", "testItem", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/InventoryItemsListByVCenterSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/InventoryItemsListByVCenterSamples.java new file mode 100644 index 000000000000..65550222dba9 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/InventoryItemsListByVCenterSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for InventoryItems ListByVCenter. */ +public final class InventoryItemsListByVCenterSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/InventoryItems_ListByVCenter.json + */ + /** + * Sample code: InventoryItemsListByVCenter. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void inventoryItemsListByVCenter( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.inventoryItems().listByVCenter("testrg", "ContosoVCenter", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/MachineExtensionsCreateOrUpdateSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/MachineExtensionsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..3fcfb9d30bb0 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/MachineExtensionsCreateOrUpdateSamples.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.connectedvmware.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import java.io.IOException; + +/** Samples for MachineExtensions CreateOrUpdate. */ +public final class MachineExtensionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/PUTExtension.json + */ + /** + * Sample code: Create or Update a Machine Extension (PUT). + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createOrUpdateAMachineExtensionPUT( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) throws IOException { + manager + .machineExtensions() + .define("CustomScriptExtension") + .withRegion("eastus2euap") + .withExistingVirtualMachine("myResourceGroup", "myMachine") + .withPublisher("Microsoft.Compute") + .withTypePropertiesType("CustomScriptExtension") + .withTypeHandlerVersion("1.10") + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"commandToExecute\":\"powershell.exe -c \\\"Get-Process | Where-Object { $_.CPU -gt 10000" + + " }\\\"\"}", + Object.class, + SerializerEncoding.JSON)) + .create(); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/MachineExtensionsDeleteSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/MachineExtensionsDeleteSamples.java new file mode 100644 index 000000000000..18691278d592 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/MachineExtensionsDeleteSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for MachineExtensions Delete. */ +public final class MachineExtensionsDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DELETEExtension.json + */ + /** + * Sample code: Delete a Machine Extension. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteAMachineExtension( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.machineExtensions().delete("myResourceGroup", "myMachine", "MMA", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/MachineExtensionsGetSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/MachineExtensionsGetSamples.java new file mode 100644 index 000000000000..495ccfd12763 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/MachineExtensionsGetSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for MachineExtensions Get. */ +public final class MachineExtensionsGetSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GETExtension.json + */ + /** + * Sample code: Get Machine Extension. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getMachineExtension(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager + .machineExtensions() + .getWithResponse("myResourceGroup", "myMachine", "CustomScriptExtension", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/MachineExtensionsListSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/MachineExtensionsListSamples.java new file mode 100644 index 000000000000..69e93cf6ab58 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/MachineExtensionsListSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for MachineExtensions List. */ +public final class MachineExtensionsListSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/LISTExtension.json + */ + /** + * Sample code: Get all Machine Extensions. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getAllMachineExtensions( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.machineExtensions().list("myResourceGroup", "myMachine", null, Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/MachineExtensionsUpdateSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/MachineExtensionsUpdateSamples.java new file mode 100644 index 000000000000..6f132a1afc3d --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/MachineExtensionsUpdateSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.connectedvmware.models.MachineExtension; +import java.io.IOException; + +/** Samples for MachineExtensions Update. */ +public final class MachineExtensionsUpdateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/UpdateExtension.json + */ + /** + * Sample code: Create or Update a Machine Extension (PATCH). + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createOrUpdateAMachineExtensionPATCH( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) throws IOException { + MachineExtension resource = + manager + .machineExtensions() + .getWithResponse("myResourceGroup", "myMachine", "CustomScriptExtension", Context.NONE) + .getValue(); + resource + .update() + .withPublisher("Microsoft.Compute") + .withType("CustomScriptExtension") + .withTypeHandlerVersion("1.10") + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"commandToExecute\":\"powershell.exe -c \\\"Get-Process | Where-Object { $_.CPU -lt 100" + + " }\\\"\"}", + Object.class, + SerializerEncoding.JSON)) + .apply(); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/OperationsListSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/OperationsListSamples.java new file mode 100644 index 000000000000..d352ed8492bc --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListOperations.json + */ + /** + * Sample code: ListOperations. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listOperations(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.operations().list(Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ResourcePoolsCreateSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ResourcePoolsCreateSamples.java new file mode 100644 index 000000000000..222295ebd65b --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ResourcePoolsCreateSamples.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.connectedvmware.generated; + +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; + +/** Samples for ResourcePools Create. */ +public final class ResourcePoolsCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateResourcePool.json + */ + /** + * Sample code: CreateResourcePool. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createResourcePool(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager + .resourcePools() + .define("HRPool") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso")) + .withVCenterId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter") + .withMoRefId("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .create(); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ResourcePoolsDeleteSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ResourcePoolsDeleteSamples.java new file mode 100644 index 000000000000..c693452c706d --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ResourcePoolsDeleteSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for ResourcePools Delete. */ +public final class ResourcePoolsDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteResourcePool.json + */ + /** + * Sample code: DeleteResourcePool. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteResourcePool(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.resourcePools().delete("testrg", "HRPool", null, Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ResourcePoolsGetByResourceGroupSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ResourcePoolsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..cebf1db2a5e7 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ResourcePoolsGetByResourceGroupSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for ResourcePools GetByResourceGroup. */ +public final class ResourcePoolsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetResourcePool.json + */ + /** + * Sample code: GetResourcePool. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getResourcePool(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.resourcePools().getByResourceGroupWithResponse("testrg", "HRPool", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ResourcePoolsListByResourceGroupSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ResourcePoolsListByResourceGroupSamples.java new file mode 100644 index 000000000000..a5237d9c6b00 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ResourcePoolsListByResourceGroupSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for ResourcePools ListByResourceGroup. */ +public final class ResourcePoolsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListResourcePoolsByResourceGroup.json + */ + /** + * Sample code: ListResourcePoolsByResourceGroup. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listResourcePoolsByResourceGroup( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.resourcePools().listByResourceGroup("testrg", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ResourcePoolsListSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ResourcePoolsListSamples.java new file mode 100644 index 000000000000..4f688e849cac --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ResourcePoolsListSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for ResourcePools List. */ +public final class ResourcePoolsListSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListResourcePools.json + */ + /** + * Sample code: ListResourcePools. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listResourcePools(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.resourcePools().list(Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ResourcePoolsUpdateSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ResourcePoolsUpdateSamples.java new file mode 100644 index 000000000000..c6ebf5940de6 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/ResourcePoolsUpdateSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.models.ResourcePool; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ResourcePools Update. */ +public final class ResourcePoolsUpdateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/UpdateResourcePool.json + */ + /** + * Sample code: UpdateResourcePool. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void updateResourcePool(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + ResourcePool resource = + manager.resourcePools().getByResourceGroupWithResponse("testrg", "HRPool", 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/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VCentersCreateSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VCentersCreateSamples.java new file mode 100644 index 000000000000..9780a92599f5 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VCentersCreateSamples.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.connectedvmware.generated; + +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; +import com.azure.resourcemanager.connectedvmware.models.VICredential; + +/** Samples for VCenters Create. */ +public final class VCentersCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateVCenter.json + */ + /** + * Sample code: CreateVCenter. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createVCenter(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager + .vCenters() + .define("ContosoVCenter") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withFqdn("ContosoVMware.contoso.com") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso")) + .withPort(1234) + .withCredentials(new VICredential().withUsername("tempuser").withPassword("")) + .create(); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VCentersDeleteSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VCentersDeleteSamples.java new file mode 100644 index 000000000000..349b47c47721 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VCentersDeleteSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for VCenters Delete. */ +public final class VCentersDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteVCenter.json + */ + /** + * Sample code: DeleteVCenter. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteVCenter(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.vCenters().delete("testrg", "ContosoVCenter", null, Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VCentersGetByResourceGroupSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VCentersGetByResourceGroupSamples.java new file mode 100644 index 000000000000..d5d9cd15228a --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VCentersGetByResourceGroupSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for VCenters GetByResourceGroup. */ +public final class VCentersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetVCenter.json + */ + /** + * Sample code: GetVCenter. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getVCenter(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.vCenters().getByResourceGroupWithResponse("testrg", "ContosoVCenter", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VCentersListByResourceGroupSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VCentersListByResourceGroupSamples.java new file mode 100644 index 000000000000..1a701bcca915 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VCentersListByResourceGroupSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for VCenters ListByResourceGroup. */ +public final class VCentersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListVCentersByResourceGroup.json + */ + /** + * Sample code: ListVCentersByResourceGroup. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listVCentersByResourceGroup( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.vCenters().listByResourceGroup("testrg", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VCentersListSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VCentersListSamples.java new file mode 100644 index 000000000000..0a1175ad799b --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VCentersListSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for VCenters List. */ +public final class VCentersListSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListVCenters.json + */ + /** + * Sample code: ListVCenters. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listVCenters(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.vCenters().list(Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VCentersUpdateSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VCentersUpdateSamples.java new file mode 100644 index 000000000000..8f16b75b4b9b --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VCentersUpdateSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.models.VCenter; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VCenters Update. */ +public final class VCentersUpdateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/UpdateVCenter.json + */ + /** + * Sample code: UpdateVCenter. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void updateVCenter(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + VCenter resource = + manager.vCenters().getByResourceGroupWithResponse("testrg", "ContosoVCenter", 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/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachineTemplatesCreateSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachineTemplatesCreateSamples.java new file mode 100644 index 000000000000..42e6e302e5c4 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachineTemplatesCreateSamples.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.connectedvmware.generated; + +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; + +/** Samples for VirtualMachineTemplates Create. */ +public final class VirtualMachineTemplatesCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateVirtualMachineTemplate.json + */ + /** + * Sample code: CreateVirtualMachineTemplate. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createVirtualMachineTemplate( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager + .virtualMachineTemplates() + .define("WebFrontEndTemplate") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso")) + .withVCenterId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter") + .withMoRefId("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .create(); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachineTemplatesDeleteSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachineTemplatesDeleteSamples.java new file mode 100644 index 000000000000..984e11a4017b --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachineTemplatesDeleteSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineTemplates Delete. */ +public final class VirtualMachineTemplatesDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteVirtualMachineTemplate.json + */ + /** + * Sample code: DeleteVirtualMachineTemplate. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteVirtualMachineTemplate( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualMachineTemplates().delete("testrg", "WebFrontEndTemplate", null, Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachineTemplatesGetByResourceGroupSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachineTemplatesGetByResourceGroupSamples.java new file mode 100644 index 000000000000..a761ab452d93 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachineTemplatesGetByResourceGroupSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineTemplates GetByResourceGroup. */ +public final class VirtualMachineTemplatesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetVirtualMachineTemplate.json + */ + /** + * Sample code: GetVirtualMachineTemplate. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getVirtualMachineTemplate( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualMachineTemplates().getByResourceGroupWithResponse("testrg", "WebFrontEndTemplate", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachineTemplatesListByResourceGroupSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachineTemplatesListByResourceGroupSamples.java new file mode 100644 index 000000000000..dc90013d1105 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineTemplates ListByResourceGroup. */ +public final class VirtualMachineTemplatesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListVirtualMachineTemplatesByResourceGroup.json + */ + /** + * Sample code: ListVirtualMachineTemplatesByResourceGroup. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listVirtualMachineTemplatesByResourceGroup( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualMachineTemplates().listByResourceGroup("testrg", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachineTemplatesListSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachineTemplatesListSamples.java new file mode 100644 index 000000000000..e41f2757ac2d --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachineTemplatesListSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineTemplates List. */ +public final class VirtualMachineTemplatesListSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListVirtualMachineTemplates.json + */ + /** + * Sample code: ListVirtualMachineTemplates. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listVirtualMachineTemplates( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualMachineTemplates().list(Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachineTemplatesUpdateSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachineTemplatesUpdateSamples.java new file mode 100644 index 000000000000..7c3bab4a6351 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachineTemplatesUpdateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.connectedvmware.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.models.VirtualMachineTemplate; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualMachineTemplates Update. */ +public final class VirtualMachineTemplatesUpdateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/UpdateVirtualMachineTemplate.json + */ + /** + * Sample code: UpdateVirtualMachineTemplate. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void updateVirtualMachineTemplate( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + VirtualMachineTemplate resource = + manager + .virtualMachineTemplates() + .getByResourceGroupWithResponse("testrg", "WebFrontEndTemplate", 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/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachinesCreateSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachinesCreateSamples.java new file mode 100644 index 000000000000..6eb150fa351c --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachinesCreateSamples.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.connectedvmware.generated; + +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; +import com.azure.resourcemanager.connectedvmware.models.HardwareProfile; + +/** Samples for VirtualMachines Create. */ +public final class VirtualMachinesCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateVirtualMachine.json + */ + /** + * Sample code: CreateVirtualMachine. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createVirtualMachine(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager 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.ExtendedLocation/customLocations/contoso")) + .withResourcePoolId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/ResourcePools/HRPool") + .withTemplateId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VirtualMachineTemplates/WebFrontEndTemplate") + .withVCenterId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter") + .withHardwareProfile(new HardwareProfile().withMemorySizeMB(4196).withNumCPUs(4)) + .create(); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachinesDeleteSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachinesDeleteSamples.java new file mode 100644 index 000000000000..73e5ab6f4d3f --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Delete. */ +public final class VirtualMachinesDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteVirtualMachine.json + */ + /** + * Sample code: DeleteVirtualMachine. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteVirtualMachine(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualMachines().delete("testrg", "DemoVM", null, Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachinesGetByResourceGroupSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachinesGetByResourceGroupSamples.java new file mode 100644 index 000000000000..535d8ad5b085 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines GetByResourceGroup. */ +public final class VirtualMachinesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetVirtualMachine.json + */ + /** + * Sample code: GetVirtualMachine. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getVirtualMachine(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualMachines().getByResourceGroupWithResponse("testrg", "DemoVM", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachinesListByResourceGroupSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachinesListByResourceGroupSamples.java new file mode 100644 index 000000000000..9d991f3e6707 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachinesListByResourceGroupSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines ListByResourceGroup. */ +public final class VirtualMachinesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListVirtualMachinesByResourceGroup.json + */ + /** + * Sample code: ListVirtualMachinesByResourceGroup. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listVirtualMachinesByResourceGroup( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualMachines().listByResourceGroup("testrg", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachinesListSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachinesListSamples.java new file mode 100644 index 000000000000..e86837ff4b6d --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines List. */ +public final class VirtualMachinesListSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListVirtualMachines.json + */ + /** + * Sample code: ListVirtualMachines. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listVirtualMachines(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualMachines().list(Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachinesRestartSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachinesRestartSamples.java new file mode 100644 index 000000000000..65dc33327c53 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Restart. */ +public final class VirtualMachinesRestartSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/RestartVirtualMachine.json + */ + /** + * Sample code: RestartVirtualMachine. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void restartVirtualMachine(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualMachines().restart("testrg", "DemoVM", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachinesStartSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachinesStartSamples.java new file mode 100644 index 000000000000..efd5d8489190 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Start. */ +public final class VirtualMachinesStartSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/StartVirtualMachine.json + */ + /** + * Sample code: StartVirtualMachine. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void startVirtualMachine(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualMachines().start("testrg", "DemoVM", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachinesStopSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachinesStopSamples.java new file mode 100644 index 000000000000..4b52e753b896 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.models.StopVirtualMachineOptions; + +/** Samples for VirtualMachines Stop. */ +public final class VirtualMachinesStopSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/StopVirtualMachine.json + */ + /** + * Sample code: StopVirtualMachine. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void stopVirtualMachine(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager + .virtualMachines() + .stop("testrg", "DemoVM", new StopVirtualMachineOptions().withSkipShutdown(true), Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachinesUpdateSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachinesUpdateSamples.java new file mode 100644 index 000000000000..d02b2e1b7f52 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualMachinesUpdateSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.models.VirtualMachine; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualMachines Update. */ +public final class VirtualMachinesUpdateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/UpdateVirtualMachine.json + */ + /** + * Sample code: UpdateVirtualMachine. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void updateVirtualMachine(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + VirtualMachine resource = + manager.virtualMachines().getByResourceGroupWithResponse("testrg", "DemoVM", 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/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualNetworksCreateSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualNetworksCreateSamples.java new file mode 100644 index 000000000000..4260e572769c --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualNetworksCreateSamples.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.connectedvmware.generated; + +import com.azure.resourcemanager.connectedvmware.models.ExtendedLocation; + +/** Samples for VirtualNetworks Create. */ +public final class VirtualNetworksCreateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/CreateVirtualNetwork.json + */ + /** + * Sample code: CreateVirtualNetwork. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void createVirtualNetwork(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager + .virtualNetworks() + .define("ProdNetwork") + .withRegion("East US") + .withExistingResourceGroup("testrg") + .withExtendedLocation( + new ExtendedLocation() + .withType("customLocation") + .withName( + "/subscriptions/a5015e1c-867f-4533-8541-85cd470d0cfb/resourceGroups/demoRG/providers/Microsoft.ExtendedLocation/customLocations/contoso")) + .withVCenterId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ConnectedVMwarevSphere/VCenters/ContosoVCenter") + .withMoRefId("aaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .create(); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualNetworksDeleteSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualNetworksDeleteSamples.java new file mode 100644 index 000000000000..6666320189bb --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworks Delete. */ +public final class VirtualNetworksDeleteSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/DeleteVirtualNetwork.json + */ + /** + * Sample code: DeleteVirtualNetwork. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void deleteVirtualNetwork(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualNetworks().delete("testrg", "ProdNetwork", null, Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualNetworksGetByResourceGroupSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualNetworksGetByResourceGroupSamples.java new file mode 100644 index 000000000000..4a1f8e9b8c5e --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworks GetByResourceGroup. */ +public final class VirtualNetworksGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/GetVirtualNetwork.json + */ + /** + * Sample code: GetVirtualNetwork. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void getVirtualNetwork(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualNetworks().getByResourceGroupWithResponse("testrg", "ProdNetwork", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualNetworksListByResourceGroupSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualNetworksListByResourceGroupSamples.java new file mode 100644 index 000000000000..e79428934818 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualNetworksListByResourceGroupSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworks ListByResourceGroup. */ +public final class VirtualNetworksListByResourceGroupSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListVirtualNetworksByResourceGroup.json + */ + /** + * Sample code: ListVirtualNetworksByResourceGroup. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listVirtualNetworksByResourceGroup( + com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualNetworks().listByResourceGroup("testrg", Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualNetworksListSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualNetworksListSamples.java new file mode 100644 index 000000000000..0e4cc88c9da9 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/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.connectedvmware.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworks List. */ +public final class VirtualNetworksListSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/ListVirtualNetworks.json + */ + /** + * Sample code: ListVirtualNetworks. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void listVirtualNetworks(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + manager.virtualNetworks().list(Context.NONE); + } +} diff --git a/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualNetworksUpdateSamples.java b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualNetworksUpdateSamples.java new file mode 100644 index 000000000000..d10055a40b70 --- /dev/null +++ b/sdk/connectedvmware/azure-resourcemanager-connectedvmware/src/samples/java/com/azure/resourcemanager/connectedvmware/generated/VirtualNetworksUpdateSamples.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.connectedvmware.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.connectedvmware.models.VirtualNetwork; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualNetworks Update. */ +public final class VirtualNetworksUpdateSamples { + /* + * x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2020-10-01-preview/examples/UpdateVirtualNetwork.json + */ + /** + * Sample code: UpdateVirtualNetwork. + * + * @param manager Entry point to ConnectedVMwareManager. + */ + public static void updateVirtualNetwork(com.azure.resourcemanager.connectedvmware.ConnectedVMwareManager manager) { + VirtualNetwork resource = + manager.virtualNetworks().getByResourceGroupWithResponse("testrg", "ProdNetwork", 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/connectedvmware/ci.yml b/sdk/connectedvmware/ci.yml new file mode 100644 index 000000000000..c02b2815e57f --- /dev/null +++ b/sdk/connectedvmware/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/connectedvmware/ci.yml + - sdk/connectedvmware/azure-resourcemanager-connectedvmware/ + exclude: + - sdk/connectedvmware/pom.xml + - sdk/connectedvmware/azure-resourcemanager-connectedvmware/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/connectedvmware/ci.yml + - sdk/connectedvmware/azure-resourcemanager-connectedvmware/ + exclude: + - sdk/connectedvmware/pom.xml + - sdk/connectedvmware/azure-resourcemanager-connectedvmware/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: connectedvmware + Artifacts: + - name: azure-resourcemanager-connectedvmware + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerconnectedvmware diff --git a/sdk/connectedvmware/pom.xml b/sdk/connectedvmware/pom.xml new file mode 100644 index 000000000000..699529b539a1 --- /dev/null +++ b/sdk/connectedvmware/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-connectedvmware-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-connectedvmware + + + +