diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/CHANGELOG.md b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/CHANGELOG.md index af7e03153024..f1d2c0e5465f 100644 --- a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/CHANGELOG.md +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/CHANGELOG.md @@ -1,7 +1,8 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.1 (2021-11-11) +- Azure Resource Manager HybridCompute client library for Java. This package contains Microsoft Azure SDK for HybridCompute Management SDK. The Hybrid Compute Management Client. Package tag package-preview-2021-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## 1.0.0-beta.1 (2021-04-15) diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/README.md b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/README.md index 734229fd8477..4dd259280aa0 100644 --- a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/README.md +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/README.md @@ -2,7 +2,7 @@ Azure Resource Manager HybridCompute client library for Java. -This package contains Microsoft Azure SDK for HybridCompute Management SDK. The Hybrid Compute Management Client. Package tag package-preview-2021-03. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for HybridCompute Management SDK. The Hybrid Compute Management Client. Package tag package-preview-2021-06. 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 @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-hybridcompute - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -74,6 +74,9 @@ See [API design][design] for general introduction on design and key concepts on ## Examples +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/hybridcompute/azure-resourcemanager-hybridcompute/SAMPLE.md) + + ## Troubleshooting ## Next steps diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/SAMPLE.md b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/SAMPLE.md new file mode 100644 index 000000000000..01071ded524d --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/SAMPLE.md @@ -0,0 +1,714 @@ +# Code snippets and samples + + +## MachineExtensions + +- [CreateOrUpdate](#machineextensions_createorupdate) +- [Delete](#machineextensions_delete) +- [Get](#machineextensions_get) +- [List](#machineextensions_list) +- [Update](#machineextensions_update) + +## Machines + +- [Delete](#machines_delete) +- [GetByResourceGroup](#machines_getbyresourcegroup) +- [List](#machines_list) +- [ListByResourceGroup](#machines_listbyresourcegroup) + +## PrivateEndpointConnections + +- [CreateOrUpdate](#privateendpointconnections_createorupdate) +- [Delete](#privateendpointconnections_delete) +- [Get](#privateendpointconnections_get) +- [ListByPrivateLinkScope](#privateendpointconnections_listbyprivatelinkscope) + +## PrivateLinkResources + +- [Get](#privatelinkresources_get) +- [ListByPrivateLinkScope](#privatelinkresources_listbyprivatelinkscope) + +## PrivateLinkScopes + +- [CreateOrUpdate](#privatelinkscopes_createorupdate) +- [Delete](#privatelinkscopes_delete) +- [GetByResourceGroup](#privatelinkscopes_getbyresourcegroup) +- [GetValidationDetails](#privatelinkscopes_getvalidationdetails) +- [GetValidationDetailsForMachine](#privatelinkscopes_getvalidationdetailsformachine) +- [List](#privatelinkscopes_list) +- [ListByResourceGroup](#privatelinkscopes_listbyresourcegroup) +- [UpdateTags](#privatelinkscopes_updatetags) + +## ResourceProvider + +- [UpgradeExtensions](#resourceprovider_upgradeextensions) +### MachineExtensions_CreateOrUpdate + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.hybridcompute.models.MachineExtensionProperties; +import java.io.IOException; + +/** Samples for MachineExtensions CreateOrUpdate. */ +public final class MachineExtensionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PUTExtension.json + */ + /** + * Sample code: Create or Update a Machine Extension. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void createOrUpdateAMachineExtension( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) throws IOException { + manager + .machineExtensions() + .define("CustomScriptExtension") + .withRegion("eastus2euap") + .withExistingMachine("myResourceGroup", "myMachine") + .withProperties( + new MachineExtensionProperties() + .withPublisher("Microsoft.Compute") + .withType("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/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/DELETEExtension.json + */ + /** + * Sample code: Delete a Machine Extension. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void deleteAMachineExtension(com.azure.resourcemanager.hybridcompute.HybridComputeManager 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/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/GETExtension.json + */ + /** + * Sample code: GET Machine Extension. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void gETMachineExtension(com.azure.resourcemanager.hybridcompute.HybridComputeManager 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/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/LISTExtension.json + */ + /** + * Sample code: GET all Machine Extensions. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void gETAllMachineExtensions(com.azure.resourcemanager.hybridcompute.HybridComputeManager 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.hybridcompute.models.MachineExtension; +import com.azure.resourcemanager.hybridcompute.models.MachineExtensionUpdateProperties; +import java.io.IOException; + +/** Samples for MachineExtensions Update. */ +public final class MachineExtensionsUpdateSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/UpdateExtension.json + */ + /** + * Sample code: Create or Update a Machine Extension. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void createOrUpdateAMachineExtension( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) throws IOException { + MachineExtension resource = + manager + .machineExtensions() + .getWithResponse("myResourceGroup", "myMachine", "CustomScriptExtension", Context.NONE) + .getValue(); + resource + .update() + .withProperties( + new MachineExtensionUpdateProperties() + .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(); + } +} +``` + +### Machines_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Machines Delete. */ +public final class MachinesDeleteSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/Machines_Delete.json + */ + /** + * Sample code: Delete a Machine. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void deleteAMachine(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager.machines().deleteWithResponse("myResourceGroup", "myMachine", Context.NONE); + } +} +``` + +### Machines_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Machines GetByResourceGroup. */ +public final class MachinesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/Machines_Get.json + */ + /** + * Sample code: Get Machine. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void getMachine(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager.machines().getByResourceGroupWithResponse("myResourceGroup", "myMachine", null, Context.NONE); + } +} +``` + +### Machines_List + +```java +import com.azure.core.util.Context; + +/** Samples for Machines List. */ +public final class MachinesListSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/Machines_ListBySubscription.json + */ + /** + * Sample code: List Machines by resource group. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void listMachinesByResourceGroup( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager.machines().list(Context.NONE); + } +} +``` + +### Machines_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Machines ListByResourceGroup. */ +public final class MachinesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/Machines_ListByResourceGroup.json + */ + /** + * Sample code: List Machines by resource group. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void listMachinesByResourceGroup( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager.machines().listByResourceGroup("myResourceGroup", Context.NONE); + } +} +``` + +### PrivateEndpointConnections_CreateOrUpdate + +```java +import com.azure.resourcemanager.hybridcompute.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.hybridcompute.models.PrivateLinkServiceConnectionStateProperty; + +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateEndpointConnectionUpdate.json + */ + /** + * Sample code: Approve or reject a private endpoint connection with a given name. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .privateEndpointConnections() + .define("private-endpoint-connection-name") + .withExistingPrivateLinkScope("myResourceGroup", "myPrivateLinkScope") + .withProperties( + new PrivateEndpointConnectionProperties() + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionStateProperty() + .withStatus("Approved") + .withDescription("Approved by johndoe@contoso.com"))) + .create(); + } +} +``` + +### PrivateEndpointConnections_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Deletes a private endpoint connection with a given name. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .privateEndpointConnections() + .delete("myResourceGroup", "myPrivateLinkScope", "private-endpoint-connection-name", Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Get + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateEndpointConnectionGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .privateEndpointConnections() + .getWithResponse("myResourceGroup", "myPrivateLinkScope", "private-endpoint-connection-name", Context.NONE); + } +} +``` + +### PrivateEndpointConnections_ListByPrivateLinkScope + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections ListByPrivateLinkScope. */ +public final class PrivateEndpointConnectionsListByPrivateLinkScopeSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateEndpointConnectionList.json + */ + /** + * Sample code: Gets list of private endpoint connections on a private link scope. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void getsListOfPrivateEndpointConnectionsOnAPrivateLinkScope( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .privateEndpointConnections() + .listByPrivateLinkScope("myResourceGroup", "myPrivateLinkScope", Context.NONE); + } +} +``` + +### PrivateLinkResources_Get + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources Get. */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopePrivateLinkResourceGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .privateLinkResources() + .getWithResponse("myResourceGroup", "myPrivateLinkScope", "hybridcompute", Context.NONE); + } +} +``` + +### PrivateLinkResources_ListByPrivateLinkScope + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources ListByPrivateLinkScope. */ +public final class PrivateLinkResourcesListByPrivateLinkScopeSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopePrivateLinkResourceListGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager.privateLinkResources().listByPrivateLinkScope("myResourceGroup", "myPrivateLinkScope", Context.NONE); + } +} +``` + +### PrivateLinkScopes_CreateOrUpdate + +```java +import java.util.HashMap; +import java.util.Map; + +/** Samples for PrivateLinkScopes CreateOrUpdate. */ +public final class PrivateLinkScopesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopesCreate.json + */ + /** + * Sample code: PrivateLinkScopeCreate. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void privateLinkScopeCreate(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .privateLinkScopes() + .define("my-privatelinkscope") + .withRegion("westus") + .withExistingResourceGroup("my-resource-group") + .create(); + } + + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopesUpdate.json + */ + /** + * Sample code: PrivateLinkScopeUpdate. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void privateLinkScopeUpdate(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .privateLinkScopes() + .define("my-privatelinkscope") + .withRegion("westus") + .withExistingResourceGroup("my-resource-group") + .withTags(mapOf("Tag1", "Value1")) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### PrivateLinkScopes_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopes Delete. */ +public final class PrivateLinkScopesDeleteSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopesDelete.json + */ + /** + * Sample code: PrivateLinkScopesDelete. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void privateLinkScopesDelete(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager.privateLinkScopes().delete("my-resource-group", "my-privatelinkscope", Context.NONE); + } +} +``` + +### PrivateLinkScopes_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopes GetByResourceGroup. */ +public final class PrivateLinkScopesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopesGet.json + */ + /** + * Sample code: PrivateLinkScopeGet. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void privateLinkScopeGet(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .privateLinkScopes() + .getByResourceGroupWithResponse("my-resource-group", "my-privatelinkscope", Context.NONE); + } +} +``` + +### PrivateLinkScopes_GetValidationDetails + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopes GetValidationDetails. */ +public final class PrivateLinkScopesGetValidationDetailsSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopesGetValidation.json + */ + /** + * Sample code: PrivateLinkScopeGet. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void privateLinkScopeGet(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .privateLinkScopes() + .getValidationDetailsWithResponse("wus2", "f5dc51d3-92ed-4d7e-947a-775ea79b4919", Context.NONE); + } +} +``` + +### PrivateLinkScopes_GetValidationDetailsForMachine + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopes GetValidationDetailsForMachine. */ +public final class PrivateLinkScopesGetValidationDetailsForMachineSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopesGetValidationForMachine.json + */ + /** + * Sample code: PrivateLinkScopeGet. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void privateLinkScopeGet(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .privateLinkScopes() + .getValidationDetailsForMachineWithResponse("my-resource-group", "machineName", Context.NONE); + } +} +``` + +### PrivateLinkScopes_List + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopes List. */ +public final class PrivateLinkScopesListSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopesList.json + */ + /** + * Sample code: PrivateLinkScopesList.json. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void privateLinkScopesListJson(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager.privateLinkScopes().list(Context.NONE); + } +} +``` + +### PrivateLinkScopes_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopes ListByResourceGroup. */ +public final class PrivateLinkScopesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopesListByResourceGroup.json + */ + /** + * Sample code: PrivateLinkScopeListByResourceGroup. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void privateLinkScopeListByResourceGroup( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager.privateLinkScopes().listByResourceGroup("my-resource-group", Context.NONE); + } +} +``` + +### PrivateLinkScopes_UpdateTags + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.hybridcompute.models.HybridComputePrivateLinkScope; +import java.util.HashMap; +import java.util.Map; + +/** Samples for PrivateLinkScopes UpdateTags. */ +public final class PrivateLinkScopesUpdateTagsSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopesUpdateTagsOnly.json + */ + /** + * Sample code: PrivateLinkScopeUpdateTagsOnly. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void privateLinkScopeUpdateTagsOnly( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + HybridComputePrivateLinkScope resource = + manager + .privateLinkScopes() + .getByResourceGroupWithResponse("my-resource-group", "my-privatelinkscope", 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; + } +} +``` + +### ResourceProvider_UpgradeExtensions + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.hybridcompute.models.ExtensionTargetProperties; +import com.azure.resourcemanager.hybridcompute.models.MachineExtensionUpgrade; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ResourceProvider UpgradeExtensions. */ +public final class ResourceProviderUpgradeExtensionsSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/Extensions_Upgrade.json + */ + /** + * Sample code: Upgrade Machine Extensions. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void upgradeMachineExtensions(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .resourceProviders() + .upgradeExtensions( + "myResourceGroup", + "myMachine", + new MachineExtensionUpgrade() + .withExtensionTargets( + mapOf( + "Microsoft.Azure.Monitoring", + new ExtensionTargetProperties().withTargetVersion("2.0"), + "Microsoft.Compute.CustomScriptExtension", + new ExtensionTargetProperties().withTargetVersion("1.10"))), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/pom.xml b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/pom.xml index ecdbf03105d4..a54e62643abf 100644 --- a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/pom.xml +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/pom.xml @@ -1,67 +1,81 @@ - 4.0.0 - - com.azure - azure-client-sdk-parent - 1.7.0 - ../../parents/azure-client-sdk-parent - + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + - com.azure.resourcemanager - azure-resourcemanager-hybridcompute - 1.0.0-beta.2 - jar + com.azure.resourcemanager + azure-resourcemanager-hybridcompute + 1.0.0-beta.2 + jar - Microsoft Azure SDK for HybridCompute Management - This package contains Microsoft Azure SDK for HybridCompute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Hybrid Compute Management Client. Package tag package-preview-2021-03. - https://github.com/Azure/azure-sdk-for-java + Microsoft Azure SDK for HybridCompute Management + This package contains Microsoft Azure SDK for HybridCompute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Hybrid Compute Management Client. Package tag package-preview-2021-06. + https://github.com/Azure/azure-sdk-for-java - - - The MIT License (MIT) - http://opensource.org/licenses/MIT - repo - - + + + 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 - - - - - com.azure - azure-core - 1.22.0 - - - com.azure - azure-core-management - 1.4.3 - - - - - - org.jacoco - jacoco-maven-plugin - 0.8.7 - - true - - - - + + 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 + false + + + + + + com.azure + azure-core + 1.22.0 + + + com.azure + azure-core-management + 1.4.3 + + + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/HybridComputeManager.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/HybridComputeManager.java index 1c1d7418fc4c..78dc07da6a1e 100644 --- a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/HybridComputeManager.java +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/HybridComputeManager.java @@ -8,8 +8,8 @@ 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.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; @@ -17,6 +17,7 @@ import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; @@ -28,17 +29,20 @@ import com.azure.resourcemanager.hybridcompute.implementation.PrivateEndpointConnectionsImpl; import com.azure.resourcemanager.hybridcompute.implementation.PrivateLinkResourcesImpl; import com.azure.resourcemanager.hybridcompute.implementation.PrivateLinkScopesImpl; +import com.azure.resourcemanager.hybridcompute.implementation.ResourceProvidersImpl; import com.azure.resourcemanager.hybridcompute.models.MachineExtensions; import com.azure.resourcemanager.hybridcompute.models.Machines; import com.azure.resourcemanager.hybridcompute.models.Operations; import com.azure.resourcemanager.hybridcompute.models.PrivateEndpointConnections; import com.azure.resourcemanager.hybridcompute.models.PrivateLinkResources; import com.azure.resourcemanager.hybridcompute.models.PrivateLinkScopes; +import com.azure.resourcemanager.hybridcompute.models.ResourceProviders; 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 HybridComputeManager. The Hybrid Compute Management Client. */ public final class HybridComputeManager { @@ -46,6 +50,8 @@ public final class HybridComputeManager { private MachineExtensions machineExtensions; + private ResourceProviders resourceProviders; + private Operations operations; private PrivateLinkScopes privateLinkScopes; @@ -97,6 +103,7 @@ public static final class Configurable { private HttpClient httpClient; private HttpLogOptions httpLogOptions; private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); private RetryPolicy retryPolicy; private Duration defaultPollInterval; @@ -136,6 +143,17 @@ public Configurable withPolicy(HttpPipelinePolicy policy) { 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. * @@ -192,20 +210,33 @@ public HybridComputeManager authenticate(TokenCredential credential, AzureProfil userAgentBuilder.append(" (auto-generated)"); } + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } if (retryPolicy == null) { retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); } List policies = new ArrayList<>(); policies.add(new UserAgentPolicy(userAgentBuilder.toString())); policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); policies - .add( - new BearerTokenAuthenticationPolicy( - credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); - policies.addAll(this.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 = @@ -233,6 +264,14 @@ public MachineExtensions machineExtensions() { return machineExtensions; } + /** @return Resource collection API of ResourceProviders. */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + /** @return Resource collection API of Operations. */ public Operations operations() { if (this.operations == null) { diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/HybridComputeManagementClient.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/HybridComputeManagementClient.java index 9363ab1e3496..d52dd0c7caa9 100644 --- a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/HybridComputeManagementClient.java +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/HybridComputeManagementClient.java @@ -58,6 +58,13 @@ public interface HybridComputeManagementClient { */ MachineExtensionsClient getMachineExtensions(); + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + /** * Gets the OperationsClient object to access its operations. * diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/MachineExtensionsClient.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/MachineExtensionsClient.java index c82677a25ea7..f27fdb1ca6d7 100644 --- a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/MachineExtensionsClient.java +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/MachineExtensionsClient.java @@ -28,7 +28,7 @@ public interface MachineExtensionsClient { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return describes a Machine Extension. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, MachineExtensionInner> beginCreateOrUpdate( String resourceGroupName, String machineName, String extensionName, MachineExtensionInner extensionParameters); @@ -45,7 +45,7 @@ SyncPoller, MachineExtensionInner> beginCreate * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return describes a Machine Extension. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, MachineExtensionInner> beginCreateOrUpdate( String resourceGroupName, String machineName, @@ -102,7 +102,7 @@ MachineExtensionInner createOrUpdate( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return describes a Machine Extension. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, MachineExtensionInner> beginUpdate( String resourceGroupName, String machineName, String extensionName, MachineExtensionUpdate extensionParameters); @@ -119,7 +119,7 @@ SyncPoller, MachineExtensionInner> beginUpdate * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return describes a Machine Extension. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, MachineExtensionInner> beginUpdate( String resourceGroupName, String machineName, @@ -175,7 +175,7 @@ MachineExtensionInner update( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String machineName, String extensionName); /** @@ -190,7 +190,7 @@ MachineExtensionInner update( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete( String resourceGroupName, String machineName, String extensionName, Context context); diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/PrivateEndpointConnectionsClient.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/PrivateEndpointConnectionsClient.java index eadfc4bb2553..c31f0b1be2be 100644 --- a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/PrivateEndpointConnectionsClient.java +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/PrivateEndpointConnectionsClient.java @@ -58,7 +58,7 @@ Response getWithResponse( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a private endpoint connection. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( String resourceGroupName, String scopeName, @@ -78,7 +78,7 @@ SyncPoller, PrivateEndpointConnection * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a private endpoint connection. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( String resourceGroupName, String scopeName, @@ -137,7 +137,7 @@ PrivateEndpointConnectionInner createOrUpdate( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete( String resourceGroupName, String scopeName, String privateEndpointConnectionName); @@ -153,7 +153,7 @@ SyncPoller, Void> beginDelete( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete( String resourceGroupName, String scopeName, String privateEndpointConnectionName, Context context); diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/PrivateLinkScopesClient.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/PrivateLinkScopesClient.java index 2ee30ea56706..2ef6d144afd2 100644 --- a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/PrivateLinkScopesClient.java +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/PrivateLinkScopesClient.java @@ -74,7 +74,7 @@ public interface PrivateLinkScopesClient { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String scopeName); /** @@ -88,7 +88,7 @@ public interface PrivateLinkScopesClient { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String scopeName, Context context); /** diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/ResourceProvidersClient.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/ResourceProvidersClient.java new file mode 100644 index 000000000000..55fb11d2b8da --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/ResourceProvidersClient.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.hybridcompute.models.MachineExtensionUpgrade; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public interface ResourceProvidersClient { + /** + * The operation to Upgrade Machine Extensions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param machineName The name of the hybrid machine. + * @param extensionUpgradeParameters Parameters supplied to the Upgrade Extensions operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginUpgradeExtensions( + String resourceGroupName, String machineName, MachineExtensionUpgrade extensionUpgradeParameters); + + /** + * The operation to Upgrade Machine Extensions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param machineName The name of the hybrid machine. + * @param extensionUpgradeParameters Parameters supplied to the Upgrade Extensions 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 completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginUpgradeExtensions( + String resourceGroupName, + String machineName, + MachineExtensionUpgrade extensionUpgradeParameters, + Context context); + + /** + * The operation to Upgrade Machine Extensions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param machineName The name of the hybrid machine. + * @param extensionUpgradeParameters Parameters supplied to the Upgrade Extensions operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 upgradeExtensions( + String resourceGroupName, String machineName, MachineExtensionUpgrade extensionUpgradeParameters); + + /** + * The operation to Upgrade Machine Extensions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param machineName The name of the hybrid machine. + * @param extensionUpgradeParameters Parameters supplied to the Upgrade Extensions 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void upgradeExtensions( + String resourceGroupName, + String machineName, + MachineExtensionUpgrade extensionUpgradeParameters, + Context context); +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/models/PatchSettings.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/models/PatchSettings.java new file mode 100644 index 000000000000..c8e3e9c1cd13 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/models/PatchSettings.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.hybridcompute.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Specifies the patch settings. */ +@Fluent +public final class PatchSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PatchSettings.class); + + /* + * Specifies the assessment mode. + */ + @JsonProperty(value = "assessmentMode") + private String assessmentMode; + + /** + * Get the assessmentMode property: Specifies the assessment mode. + * + * @return the assessmentMode value. + */ + public String assessmentMode() { + return this.assessmentMode; + } + + /** + * Set the assessmentMode property: Specifies the assessment mode. + * + * @param assessmentMode the assessmentMode value to set. + * @return the PatchSettings object itself. + */ + public PatchSettings withAssessmentMode(String assessmentMode) { + this.assessmentMode = assessmentMode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/HybridComputeManagementClientImpl.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/HybridComputeManagementClientImpl.java index 0f4f2680c64c..60af920c0c49 100644 --- a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/HybridComputeManagementClientImpl.java +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/HybridComputeManagementClientImpl.java @@ -28,6 +28,7 @@ import com.azure.resourcemanager.hybridcompute.fluent.PrivateEndpointConnectionsClient; import com.azure.resourcemanager.hybridcompute.fluent.PrivateLinkResourcesClient; import com.azure.resourcemanager.hybridcompute.fluent.PrivateLinkScopesClient; +import com.azure.resourcemanager.hybridcompute.fluent.ResourceProvidersClient; import java.io.IOException; import java.lang.reflect.Type; import java.nio.ByteBuffer; @@ -139,6 +140,18 @@ public MachineExtensionsClient getMachineExtensions() { return this.machineExtensions; } + /** The ResourceProvidersClient object to access its operations. */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + /** The OperationsClient object to access its operations. */ private final OperationsClient operations; @@ -209,9 +222,10 @@ public PrivateEndpointConnectionsClient getPrivateEndpointConnections() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2021-03-25-preview"; + this.apiVersion = "2021-06-10-preview"; this.machines = new MachinesClientImpl(this); this.machineExtensions = new MachineExtensionsClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); this.operations = new OperationsClientImpl(this); this.privateLinkScopes = new PrivateLinkScopesClientImpl(this); this.privateLinkResources = new PrivateLinkResourcesClientImpl(this); diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachineExtensionsClientImpl.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachineExtensionsClientImpl.java index b6beaeb5f7bf..2987db36ebeb 100644 --- a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachineExtensionsClientImpl.java +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachineExtensionsClientImpl.java @@ -298,7 +298,7 @@ private Mono>> createOrUpdateWithResponseAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return describes a Machine Extension. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, MachineExtensionInner> beginCreateOrUpdateAsync( String resourceGroupName, String machineName, String extensionName, MachineExtensionInner extensionParameters) { Mono>> mono = @@ -326,7 +326,7 @@ private PollerFlux, MachineExtensionInner> beg * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return describes a Machine Extension. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, MachineExtensionInner> beginCreateOrUpdateAsync( String resourceGroupName, String machineName, @@ -355,7 +355,7 @@ private PollerFlux, MachineExtensionInner> beg * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return describes a Machine Extension. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, MachineExtensionInner> beginCreateOrUpdate( String resourceGroupName, String machineName, String extensionName, MachineExtensionInner extensionParameters) { return beginCreateOrUpdateAsync(resourceGroupName, machineName, extensionName, extensionParameters) @@ -375,7 +375,7 @@ public SyncPoller, MachineExtensionInner> begi * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return describes a Machine Extension. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, MachineExtensionInner> beginCreateOrUpdate( String resourceGroupName, String machineName, @@ -611,7 +611,7 @@ private Mono>> updateWithResponseAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return describes a Machine Extension. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, MachineExtensionInner> beginUpdateAsync( String resourceGroupName, String machineName, @@ -642,7 +642,7 @@ private PollerFlux, MachineExtensionInner> beg * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return describes a Machine Extension. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, MachineExtensionInner> beginUpdateAsync( String resourceGroupName, String machineName, @@ -670,7 +670,7 @@ private PollerFlux, MachineExtensionInner> beg * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return describes a Machine Extension. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, MachineExtensionInner> beginUpdate( String resourceGroupName, String machineName, @@ -692,7 +692,7 @@ public SyncPoller, MachineExtensionInner> begi * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return describes a Machine Extension. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, MachineExtensionInner> beginUpdate( String resourceGroupName, String machineName, @@ -910,7 +910,7 @@ private Mono>> deleteWithResponseAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync( String resourceGroupName, String machineName, String extensionName) { Mono>> mono = deleteWithResponseAsync(resourceGroupName, machineName, extensionName); @@ -931,7 +931,7 @@ private PollerFlux, Void> beginDeleteAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync( String resourceGroupName, String machineName, String extensionName, Context context) { context = this.client.mergeContext(context); @@ -953,7 +953,7 @@ private PollerFlux, Void> beginDeleteAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete( String resourceGroupName, String machineName, String extensionName) { return beginDeleteAsync(resourceGroupName, machineName, extensionName).getSyncPoller(); @@ -971,7 +971,7 @@ public SyncPoller, Void> beginDelete( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete( String resourceGroupName, String machineName, String extensionName, Context context) { return beginDeleteAsync(resourceGroupName, machineName, extensionName, context).getSyncPoller(); diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/PrivateEndpointConnectionsClientImpl.java index 51ebe5959e09..b80b17a5cba9 100644 --- a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/PrivateEndpointConnectionsClientImpl.java +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/PrivateEndpointConnectionsClientImpl.java @@ -457,7 +457,7 @@ private Mono>> createOrUpdateWithResponseAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a private endpoint connection. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, PrivateEndpointConnectionInner> beginCreateOrUpdateAsync( String resourceGroupName, @@ -489,7 +489,7 @@ private Mono>> createOrUpdateWithResponseAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a private endpoint connection. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, PrivateEndpointConnectionInner> beginCreateOrUpdateAsync( String resourceGroupName, @@ -523,7 +523,7 @@ private Mono>> createOrUpdateWithResponseAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a private endpoint connection. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( String resourceGroupName, String scopeName, @@ -546,7 +546,7 @@ public SyncPoller, PrivateEndpointCon * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a private endpoint connection. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( String resourceGroupName, String scopeName, @@ -773,7 +773,7 @@ private Mono>> deleteWithResponseAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync( String resourceGroupName, String scopeName, String privateEndpointConnectionName) { Mono>> mono = @@ -795,7 +795,7 @@ private PollerFlux, Void> beginDeleteAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync( String resourceGroupName, String scopeName, String privateEndpointConnectionName, Context context) { context = this.client.mergeContext(context); @@ -817,7 +817,7 @@ private PollerFlux, Void> beginDeleteAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete( String resourceGroupName, String scopeName, String privateEndpointConnectionName) { return beginDeleteAsync(resourceGroupName, scopeName, privateEndpointConnectionName).getSyncPoller(); @@ -835,7 +835,7 @@ public SyncPoller, Void> beginDelete( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete( String resourceGroupName, String scopeName, String privateEndpointConnectionName, Context context) { return beginDeleteAsync(resourceGroupName, scopeName, privateEndpointConnectionName, context).getSyncPoller(); diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/PrivateLinkScopesClientImpl.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/PrivateLinkScopesClientImpl.java index 1efa5ca82854..040cd733f076 100644 --- a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/PrivateLinkScopesClientImpl.java +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/PrivateLinkScopesClientImpl.java @@ -617,7 +617,7 @@ private Mono>> deleteWithResponseAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String scopeName) { Mono>> mono = deleteWithResponseAsync(resourceGroupName, scopeName); return this @@ -636,7 +636,7 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync( String resourceGroupName, String scopeName, Context context) { context = this.client.mergeContext(context); @@ -656,7 +656,7 @@ private PollerFlux, Void> beginDeleteAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String scopeName) { return beginDeleteAsync(resourceGroupName, scopeName).getSyncPoller(); } @@ -672,7 +672,7 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String scopeName, Context context) { return beginDeleteAsync(resourceGroupName, scopeName, context).getSyncPoller(); } diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/ResourceProvidersClientImpl.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 000000000000..6f48216f25b2 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,360 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.hybridcompute.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.hybridcompute.models.MachineExtensionUpgrade; +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 ResourceProvidersClient. */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + private final ClientLogger logger = new ClientLogger(ResourceProvidersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ResourceProvidersService service; + + /** The service client containing this operation class. */ + private final HybridComputeManagementClientImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(HybridComputeManagementClientImpl client) { + this.service = + RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for HybridComputeManagementClientResourceProviders to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "HybridComputeManagem") + private interface ResourceProvidersService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute" + + "/machines/{machineName}/upgradeExtensions") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> upgradeExtensions( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("machineName") String machineName, + @BodyParam("application/json") MachineExtensionUpgrade extensionUpgradeParameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * The operation to Upgrade Machine Extensions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param machineName The name of the hybrid machine. + * @param extensionUpgradeParameters Parameters supplied to the Upgrade Extensions operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> upgradeExtensionsWithResponseAsync( + String resourceGroupName, String machineName, MachineExtensionUpgrade extensionUpgradeParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (machineName == null) { + return Mono.error(new IllegalArgumentException("Parameter machineName is required and cannot be null.")); + } + if (extensionUpgradeParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter extensionUpgradeParameters is required and cannot be null.")); + } else { + extensionUpgradeParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .upgradeExtensions( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + machineName, + extensionUpgradeParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to Upgrade Machine Extensions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param machineName The name of the hybrid machine. + * @param extensionUpgradeParameters Parameters supplied to the Upgrade Extensions 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> upgradeExtensionsWithResponseAsync( + String resourceGroupName, + String machineName, + MachineExtensionUpgrade extensionUpgradeParameters, + 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 (machineName == null) { + return Mono.error(new IllegalArgumentException("Parameter machineName is required and cannot be null.")); + } + if (extensionUpgradeParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter extensionUpgradeParameters is required and cannot be null.")); + } else { + extensionUpgradeParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .upgradeExtensions( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + machineName, + extensionUpgradeParameters, + accept, + context); + } + + /** + * The operation to Upgrade Machine Extensions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param machineName The name of the hybrid machine. + * @param extensionUpgradeParameters Parameters supplied to the Upgrade Extensions operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginUpgradeExtensionsAsync( + String resourceGroupName, String machineName, MachineExtensionUpgrade extensionUpgradeParameters) { + Mono>> mono = + upgradeExtensionsWithResponseAsync(resourceGroupName, machineName, extensionUpgradeParameters); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * The operation to Upgrade Machine Extensions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param machineName The name of the hybrid machine. + * @param extensionUpgradeParameters Parameters supplied to the Upgrade Extensions 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 completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginUpgradeExtensionsAsync( + String resourceGroupName, + String machineName, + MachineExtensionUpgrade extensionUpgradeParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + upgradeExtensionsWithResponseAsync(resourceGroupName, machineName, extensionUpgradeParameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The operation to Upgrade Machine Extensions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param machineName The name of the hybrid machine. + * @param extensionUpgradeParameters Parameters supplied to the Upgrade Extensions operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginUpgradeExtensions( + String resourceGroupName, String machineName, MachineExtensionUpgrade extensionUpgradeParameters) { + return beginUpgradeExtensionsAsync(resourceGroupName, machineName, extensionUpgradeParameters).getSyncPoller(); + } + + /** + * The operation to Upgrade Machine Extensions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param machineName The name of the hybrid machine. + * @param extensionUpgradeParameters Parameters supplied to the Upgrade Extensions 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 completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginUpgradeExtensions( + String resourceGroupName, + String machineName, + MachineExtensionUpgrade extensionUpgradeParameters, + Context context) { + return beginUpgradeExtensionsAsync(resourceGroupName, machineName, extensionUpgradeParameters, context) + .getSyncPoller(); + } + + /** + * The operation to Upgrade Machine Extensions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param machineName The name of the hybrid machine. + * @param extensionUpgradeParameters Parameters supplied to the Upgrade Extensions operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono upgradeExtensionsAsync( + String resourceGroupName, String machineName, MachineExtensionUpgrade extensionUpgradeParameters) { + return beginUpgradeExtensionsAsync(resourceGroupName, machineName, extensionUpgradeParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to Upgrade Machine Extensions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param machineName The name of the hybrid machine. + * @param extensionUpgradeParameters Parameters supplied to the Upgrade Extensions 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono upgradeExtensionsAsync( + String resourceGroupName, + String machineName, + MachineExtensionUpgrade extensionUpgradeParameters, + Context context) { + return beginUpgradeExtensionsAsync(resourceGroupName, machineName, extensionUpgradeParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to Upgrade Machine Extensions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param machineName The name of the hybrid machine. + * @param extensionUpgradeParameters Parameters supplied to the Upgrade Extensions operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 upgradeExtensions( + String resourceGroupName, String machineName, MachineExtensionUpgrade extensionUpgradeParameters) { + upgradeExtensionsAsync(resourceGroupName, machineName, extensionUpgradeParameters).block(); + } + + /** + * The operation to Upgrade Machine Extensions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param machineName The name of the hybrid machine. + * @param extensionUpgradeParameters Parameters supplied to the Upgrade Extensions 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void upgradeExtensions( + String resourceGroupName, + String machineName, + MachineExtensionUpgrade extensionUpgradeParameters, + Context context) { + upgradeExtensionsAsync(resourceGroupName, machineName, extensionUpgradeParameters, context).block(); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/ResourceProvidersImpl.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/ResourceProvidersImpl.java new file mode 100644 index 000000000000..560dd8adb4fd --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/ResourceProvidersImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hybridcompute.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.hybridcompute.models.MachineExtensionUpgrade; +import com.azure.resourcemanager.hybridcompute.models.ResourceProviders; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ResourceProvidersImpl implements ResourceProviders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final com.azure.resourcemanager.hybridcompute.HybridComputeManager serviceManager; + + public ResourceProvidersImpl( + ResourceProvidersClient innerClient, + com.azure.resourcemanager.hybridcompute.HybridComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void upgradeExtensions( + String resourceGroupName, String machineName, MachineExtensionUpgrade extensionUpgradeParameters) { + this.serviceClient().upgradeExtensions(resourceGroupName, machineName, extensionUpgradeParameters); + } + + public void upgradeExtensions( + String resourceGroupName, + String machineName, + MachineExtensionUpgrade extensionUpgradeParameters, + Context context) { + this.serviceClient().upgradeExtensions(resourceGroupName, machineName, extensionUpgradeParameters, context); + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.hybridcompute.HybridComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/ExtensionTargetProperties.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/ExtensionTargetProperties.java new file mode 100644 index 000000000000..c36a1a4f55cb --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/ExtensionTargetProperties.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.hybridcompute.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the Machine Extension Target Version Properties. */ +@Fluent +public final class ExtensionTargetProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExtensionTargetProperties.class); + + /* + * Properties for the specified Extension to Upgrade. + */ + @JsonProperty(value = "targetVersion") + private String targetVersion; + + /** + * Get the targetVersion property: Properties for the specified Extension to Upgrade. + * + * @return the targetVersion value. + */ + public String targetVersion() { + return this.targetVersion; + } + + /** + * Set the targetVersion property: Properties for the specified Extension to Upgrade. + * + * @param targetVersion the targetVersion value to set. + * @return the ExtensionTargetProperties object itself. + */ + public ExtensionTargetProperties withTargetVersion(String targetVersion) { + this.targetVersion = targetVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/HybridComputePrivateLinkScopeProperties.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/HybridComputePrivateLinkScopeProperties.java index 24dc7ae03bdc..a434adcebe01 100644 --- a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/HybridComputePrivateLinkScopeProperties.java +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/HybridComputePrivateLinkScopeProperties.java @@ -8,6 +8,7 @@ import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; /** Properties that define a Azure Arc PrivateLinkScope resource. */ @Fluent @@ -36,6 +37,12 @@ public final class HybridComputePrivateLinkScopeProperties { @JsonProperty(value = "privateLinkScopeId", access = JsonProperty.Access.WRITE_ONLY) private String privateLinkScopeId; + /* + * The collection of associated Private Endpoint Connections. + */ + @JsonProperty(value = "privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + /** * Get the publicNetworkAccess property: Indicates whether machines associated with the private link scope can also * use public Azure Arc service endpoints. @@ -79,11 +86,23 @@ public String privateLinkScopeId() { return this.privateLinkScopeId; } + /** + * Get the privateEndpointConnections property: The collection of associated Private Endpoint Connections. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } } } diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionUpgrade.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionUpgrade.java new file mode 100644 index 000000000000..c980a3680c77 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionUpgrade.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Describes the Machine Extension Upgrade Properties. */ +@Fluent +public final class MachineExtensionUpgrade { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachineExtensionUpgrade.class); + + /* + * Describes the Extension Target Properties. + */ + @JsonProperty(value = "extensionTargets") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map extensionTargets; + + /** + * Get the extensionTargets property: Describes the Extension Target Properties. + * + * @return the extensionTargets value. + */ + public Map extensionTargets() { + return this.extensionTargets; + } + + /** + * Set the extensionTargets property: Describes the Extension Target Properties. + * + * @param extensionTargets the extensionTargets value to set. + * @return the MachineExtensionUpgrade object itself. + */ + public MachineExtensionUpgrade withExtensionTargets(Map extensionTargets) { + this.extensionTargets = extensionTargets; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (extensionTargets() != null) { + extensionTargets() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineProperties.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineProperties.java index 050aba734e6c..3d5f08dd737c 100644 --- a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineProperties.java +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineProperties.java @@ -8,6 +8,7 @@ import com.azure.core.management.exception.ManagementError; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; import java.util.List; @@ -27,7 +28,7 @@ public final class MachineProperties { /* * Specifies the operating system settings for the hybrid machine. */ - @JsonProperty(value = "osProfile", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "osProfile") private OSProfile osProfile; /* @@ -97,6 +98,12 @@ public final class MachineProperties { @JsonProperty(value = "osVersion", access = JsonProperty.Access.WRITE_ONLY) private String osVersion; + /* + * The type of Operating System (windows/linux). + */ + @JsonProperty(value = "osType") + private String osType; + /* * Specifies the Arc Machine's unique SMBIOS ID */ @@ -147,10 +154,17 @@ public final class MachineProperties { @JsonProperty(value = "parentClusterResourceId") private String parentClusterResourceId; + /* + * Specifies whether any MS SQL instance is discovered on the machine. + */ + @JsonProperty(value = "mssqlDiscovered") + private String mssqlDiscovered; + /* * Detected properties from the machine. */ @JsonProperty(value = "detectedProperties", access = JsonProperty.Access.WRITE_ONLY) + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map detectedProperties; /** @@ -182,6 +196,17 @@ public OSProfile osProfile() { return this.osProfile; } + /** + * Set the osProfile property: Specifies the operating system settings for the hybrid machine. + * + * @param osProfile the osProfile value to set. + * @return the MachineProperties object itself. + */ + public MachineProperties withOsProfile(OSProfile osProfile) { + this.osProfile = osProfile; + return this; + } + /** * Get the provisioningState property: The provisioning state, which only appears in the response. * @@ -305,6 +330,26 @@ public String osVersion() { return this.osVersion; } + /** + * Get the osType property: The type of Operating System (windows/linux). + * + * @return the osType value. + */ + public String osType() { + return this.osType; + } + + /** + * Set the osType property: The type of Operating System (windows/linux). + * + * @param osType the osType value to set. + * @return the MachineProperties object itself. + */ + public MachineProperties withOsType(String osType) { + this.osType = osType; + return this; + } + /** * Get the vmUuid property: Specifies the Arc Machine's unique SMBIOS ID. * @@ -414,6 +459,26 @@ public MachineProperties withParentClusterResourceId(String parentClusterResourc return this; } + /** + * Get the mssqlDiscovered property: Specifies whether any MS SQL instance is discovered on the machine. + * + * @return the mssqlDiscovered value. + */ + public String mssqlDiscovered() { + return this.mssqlDiscovered; + } + + /** + * Set the mssqlDiscovered property: Specifies whether any MS SQL instance is discovered on the machine. + * + * @param mssqlDiscovered the mssqlDiscovered value to set. + * @return the MachineProperties object itself. + */ + public MachineProperties withMssqlDiscovered(String mssqlDiscovered) { + this.mssqlDiscovered = mssqlDiscovered; + return this; + } + /** * Get the detectedProperties property: Detected properties from the machine. * diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineUpdateProperties.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineUpdateProperties.java index 08a318d41042..79782aa53d77 100644 --- a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineUpdateProperties.java +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineUpdateProperties.java @@ -20,6 +20,12 @@ public final class MachineUpdateProperties { @JsonProperty(value = "locationData") private LocationData locationData; + /* + * Specifies the operating system settings for the hybrid machine. + */ + @JsonProperty(value = "osProfile") + private OSProfile osProfile; + /* * The resource id of the parent cluster (Azure HCI) this machine is * assigned to, if any. @@ -54,6 +60,26 @@ public MachineUpdateProperties withLocationData(LocationData locationData) { return this; } + /** + * Get the osProfile property: Specifies the operating system settings for the hybrid machine. + * + * @return the osProfile value. + */ + public OSProfile osProfile() { + return this.osProfile; + } + + /** + * Set the osProfile property: Specifies the operating system settings for the hybrid machine. + * + * @param osProfile the osProfile value to set. + * @return the MachineUpdateProperties object itself. + */ + public MachineUpdateProperties withOsProfile(OSProfile osProfile) { + this.osProfile = osProfile; + return this; + } + /** * Get the parentClusterResourceId property: The resource id of the parent cluster (Azure HCI) this machine is * assigned to, if any. @@ -107,5 +133,8 @@ public void validate() { if (locationData() != null) { locationData().validate(); } + if (osProfile() != null) { + osProfile().validate(); + } } } diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OSProfile.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OSProfile.java index 3f9e493402d3..e266a60cfaa4 100644 --- a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OSProfile.java +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OSProfile.java @@ -4,13 +4,13 @@ package com.azure.resourcemanager.hybridcompute.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** Specifies the operating system settings for the hybrid machine. */ -@Immutable +@Fluent public final class OSProfile { @JsonIgnore private final ClientLogger logger = new ClientLogger(OSProfile.class); @@ -20,6 +20,18 @@ public final class OSProfile { @JsonProperty(value = "computerName", access = JsonProperty.Access.WRITE_ONLY) private String computerName; + /* + * Specifies the windows configuration for update management. + */ + @JsonProperty(value = "windowsConfiguration") + private OSProfileWindowsConfiguration windowsConfiguration; + + /* + * Specifies the linux configuration for update management. + */ + @JsonProperty(value = "linuxConfiguration") + private OSProfileLinuxConfiguration linuxConfiguration; + /** * Get the computerName property: Specifies the host OS name of the hybrid machine. * @@ -29,11 +41,57 @@ public String computerName() { return this.computerName; } + /** + * Get the windowsConfiguration property: Specifies the windows configuration for update management. + * + * @return the windowsConfiguration value. + */ + public OSProfileWindowsConfiguration windowsConfiguration() { + return this.windowsConfiguration; + } + + /** + * Set the windowsConfiguration property: Specifies the windows configuration for update management. + * + * @param windowsConfiguration the windowsConfiguration value to set. + * @return the OSProfile object itself. + */ + public OSProfile withWindowsConfiguration(OSProfileWindowsConfiguration windowsConfiguration) { + this.windowsConfiguration = windowsConfiguration; + return this; + } + + /** + * Get the linuxConfiguration property: Specifies the linux configuration for update management. + * + * @return the linuxConfiguration value. + */ + public OSProfileLinuxConfiguration linuxConfiguration() { + return this.linuxConfiguration; + } + + /** + * Set the linuxConfiguration property: Specifies the linux configuration for update management. + * + * @param linuxConfiguration the linuxConfiguration value to set. + * @return the OSProfile object itself. + */ + public OSProfile withLinuxConfiguration(OSProfileLinuxConfiguration linuxConfiguration) { + this.linuxConfiguration = linuxConfiguration; + return this; + } + /** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (windowsConfiguration() != null) { + windowsConfiguration().validate(); + } + if (linuxConfiguration() != null) { + linuxConfiguration().validate(); + } } } diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OSProfileLinuxConfiguration.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OSProfileLinuxConfiguration.java new file mode 100644 index 000000000000..c6d39a855af0 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OSProfileLinuxConfiguration.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hybridcompute.fluent.models.PatchSettings; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Specifies the linux configuration for update management. */ +@Fluent +public final class OSProfileLinuxConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OSProfileLinuxConfiguration.class); + + /* + * Specifies the patch settings. + */ + @JsonProperty(value = "patchSettings") + private PatchSettings innerPatchSettings; + + /** + * Get the innerPatchSettings property: Specifies the patch settings. + * + * @return the innerPatchSettings value. + */ + private PatchSettings innerPatchSettings() { + return this.innerPatchSettings; + } + + /** + * Get the assessmentMode property: Specifies the assessment mode. + * + * @return the assessmentMode value. + */ + public String assessmentMode() { + return this.innerPatchSettings() == null ? null : this.innerPatchSettings().assessmentMode(); + } + + /** + * Set the assessmentMode property: Specifies the assessment mode. + * + * @param assessmentMode the assessmentMode value to set. + * @return the OSProfileLinuxConfiguration object itself. + */ + public OSProfileLinuxConfiguration withAssessmentMode(String assessmentMode) { + if (this.innerPatchSettings() == null) { + this.innerPatchSettings = new PatchSettings(); + } + this.innerPatchSettings().withAssessmentMode(assessmentMode); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerPatchSettings() != null) { + innerPatchSettings().validate(); + } + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OSProfileWindowsConfiguration.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OSProfileWindowsConfiguration.java new file mode 100644 index 000000000000..0712ed1e242c --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OSProfileWindowsConfiguration.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hybridcompute.fluent.models.PatchSettings; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Specifies the windows configuration for update management. */ +@Fluent +public final class OSProfileWindowsConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OSProfileWindowsConfiguration.class); + + /* + * Specifies the patch settings. + */ + @JsonProperty(value = "patchSettings") + private PatchSettings innerPatchSettings; + + /** + * Get the innerPatchSettings property: Specifies the patch settings. + * + * @return the innerPatchSettings value. + */ + private PatchSettings innerPatchSettings() { + return this.innerPatchSettings; + } + + /** + * Get the assessmentMode property: Specifies the assessment mode. + * + * @return the assessmentMode value. + */ + public String assessmentMode() { + return this.innerPatchSettings() == null ? null : this.innerPatchSettings().assessmentMode(); + } + + /** + * Set the assessmentMode property: Specifies the assessment mode. + * + * @param assessmentMode the assessmentMode value to set. + * @return the OSProfileWindowsConfiguration object itself. + */ + public OSProfileWindowsConfiguration withAssessmentMode(String assessmentMode) { + if (this.innerPatchSettings() == null) { + this.innerPatchSettings = new PatchSettings(); + } + this.innerPatchSettings().withAssessmentMode(assessmentMode); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerPatchSettings() != null) { + innerPatchSettings().validate(); + } + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/PrivateEndpointConnectionDataModel.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/PrivateEndpointConnectionDataModel.java new file mode 100644 index 000000000000..c59875b12c79 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/PrivateEndpointConnectionDataModel.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Data Model for a Private Endpoint Connection associated with a Private Link Scope. */ +@Fluent +public final class PrivateEndpointConnectionDataModel { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionDataModel.class); + + /* + * The ARM Resource Id of the Private Endpoint. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The Name of the Private Endpoint. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Azure resource type + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The Private Endpoint Connection properties. + */ + @JsonProperty(value = "properties") + private PrivateEndpointConnectionProperties properties; + + /** + * Get the id property: The ARM Resource Id of the Private Endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: The Name of the Private Endpoint. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: Azure resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the properties property: The Private Endpoint Connection properties. + * + * @return the properties value. + */ + public PrivateEndpointConnectionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The Private Endpoint Connection properties. + * + * @param properties the properties value to set. + * @return the PrivateEndpointConnectionDataModel object itself. + */ + public PrivateEndpointConnectionDataModel withProperties(PrivateEndpointConnectionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/PrivateLinkScopesResource.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/PrivateLinkScopesResource.java index 33009e13f810..79b1d660b4f9 100644 --- a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/PrivateLinkScopesResource.java +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/PrivateLinkScopesResource.java @@ -4,14 +4,14 @@ package com.azure.resourcemanager.hybridcompute.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; import java.util.Map; /** An azure resource object. */ -@Immutable +@Fluent public class PrivateLinkScopesResource extends Resource { @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkScopesResource.class); diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/ResourceProviders.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/ResourceProviders.java new file mode 100644 index 000000000000..03fb8081c738 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/ResourceProviders.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.hybridcompute.models; + +import com.azure.core.util.Context; + +/** Resource collection API of ResourceProviders. */ +public interface ResourceProviders { + /** + * The operation to Upgrade Machine Extensions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param machineName The name of the hybrid machine. + * @param extensionUpgradeParameters Parameters supplied to the Upgrade Extensions operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 upgradeExtensions( + String resourceGroupName, String machineName, MachineExtensionUpgrade extensionUpgradeParameters); + + /** + * The operation to Upgrade Machine Extensions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param machineName The name of the hybrid machine. + * @param extensionUpgradeParameters Parameters supplied to the Upgrade Extensions 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. + */ + void upgradeExtensions( + String resourceGroupName, + String machineName, + MachineExtensionUpgrade extensionUpgradeParameters, + Context context); +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/ResourceUpdate.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/ResourceUpdate.java index 21efd8494a01..e874b2006ecc 100644 --- a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/ResourceUpdate.java +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/ResourceUpdate.java @@ -7,6 +7,7 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; @@ -19,6 +20,7 @@ public class ResourceUpdate { * Resource tags */ @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; /** diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/TagsResource.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/TagsResource.java index 2ce35e9ad327..d069ee47f160 100644 --- a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/TagsResource.java +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/TagsResource.java @@ -7,6 +7,7 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; @@ -22,6 +23,7 @@ public final class TagsResource { * Resource tags */ @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; /** diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachineExtensionsCreateOrUpdateSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachineExtensionsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..46de3351df9b --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachineExtensionsCreateOrUpdateSamples.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.hybridcompute.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.hybridcompute.models.MachineExtensionProperties; +import java.io.IOException; + +/** Samples for MachineExtensions CreateOrUpdate. */ +public final class MachineExtensionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PUTExtension.json + */ + /** + * Sample code: Create or Update a Machine Extension. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void createOrUpdateAMachineExtension( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) throws IOException { + manager + .machineExtensions() + .define("CustomScriptExtension") + .withRegion("eastus2euap") + .withExistingMachine("myResourceGroup", "myMachine") + .withProperties( + new MachineExtensionProperties() + .withPublisher("Microsoft.Compute") + .withType("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/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachineExtensionsDeleteSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachineExtensionsDeleteSamples.java new file mode 100644 index 000000000000..1ab1ff31d0f9 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachineExtensionsDeleteSamples.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.hybridcompute.generated; + +import com.azure.core.util.Context; + +/** Samples for MachineExtensions Delete. */ +public final class MachineExtensionsDeleteSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/DELETEExtension.json + */ + /** + * Sample code: Delete a Machine Extension. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void deleteAMachineExtension(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager.machineExtensions().delete("myResourceGroup", "myMachine", "MMA", Context.NONE); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachineExtensionsGetSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachineExtensionsGetSamples.java new file mode 100644 index 000000000000..755e01dab8e7 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/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.hybridcompute.generated; + +import com.azure.core.util.Context; + +/** Samples for MachineExtensions Get. */ +public final class MachineExtensionsGetSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/GETExtension.json + */ + /** + * Sample code: GET Machine Extension. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void gETMachineExtension(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .machineExtensions() + .getWithResponse("myResourceGroup", "myMachine", "CustomScriptExtension", Context.NONE); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachineExtensionsListSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachineExtensionsListSamples.java new file mode 100644 index 000000000000..f23ac6a452ae --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachineExtensionsListSamples.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.hybridcompute.generated; + +import com.azure.core.util.Context; + +/** Samples for MachineExtensions List. */ +public final class MachineExtensionsListSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/LISTExtension.json + */ + /** + * Sample code: GET all Machine Extensions. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void gETAllMachineExtensions(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager.machineExtensions().list("myResourceGroup", "myMachine", null, Context.NONE); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachineExtensionsUpdateSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachineExtensionsUpdateSamples.java new file mode 100644 index 000000000000..36e566205169 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachineExtensionsUpdateSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.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.hybridcompute.models.MachineExtension; +import com.azure.resourcemanager.hybridcompute.models.MachineExtensionUpdateProperties; +import java.io.IOException; + +/** Samples for MachineExtensions Update. */ +public final class MachineExtensionsUpdateSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/UpdateExtension.json + */ + /** + * Sample code: Create or Update a Machine Extension. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void createOrUpdateAMachineExtension( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) throws IOException { + MachineExtension resource = + manager + .machineExtensions() + .getWithResponse("myResourceGroup", "myMachine", "CustomScriptExtension", Context.NONE) + .getValue(); + resource + .update() + .withProperties( + new MachineExtensionUpdateProperties() + .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/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachinesDeleteSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachinesDeleteSamples.java new file mode 100644 index 000000000000..96bd48b34784 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachinesDeleteSamples.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.hybridcompute.generated; + +import com.azure.core.util.Context; + +/** Samples for Machines Delete. */ +public final class MachinesDeleteSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/Machines_Delete.json + */ + /** + * Sample code: Delete a Machine. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void deleteAMachine(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager.machines().deleteWithResponse("myResourceGroup", "myMachine", Context.NONE); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachinesGetByResourceGroupSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachinesGetByResourceGroupSamples.java new file mode 100644 index 000000000000..910627c8c74f --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachinesGetByResourceGroupSamples.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.hybridcompute.generated; + +import com.azure.core.util.Context; + +/** Samples for Machines GetByResourceGroup. */ +public final class MachinesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/Machines_Get.json + */ + /** + * Sample code: Get Machine. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void getMachine(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager.machines().getByResourceGroupWithResponse("myResourceGroup", "myMachine", null, Context.NONE); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachinesListByResourceGroupSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachinesListByResourceGroupSamples.java new file mode 100644 index 000000000000..bbbccd0a8441 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachinesListByResourceGroupSamples.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.hybridcompute.generated; + +import com.azure.core.util.Context; + +/** Samples for Machines ListByResourceGroup. */ +public final class MachinesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/Machines_ListByResourceGroup.json + */ + /** + * Sample code: List Machines by resource group. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void listMachinesByResourceGroup( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager.machines().listByResourceGroup("myResourceGroup", Context.NONE); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachinesListSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachinesListSamples.java new file mode 100644 index 000000000000..89b958741264 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/MachinesListSamples.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.hybridcompute.generated; + +import com.azure.core.util.Context; + +/** Samples for Machines List. */ +public final class MachinesListSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/Machines_ListBySubscription.json + */ + /** + * Sample code: List Machines by resource group. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void listMachinesByResourceGroup( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager.machines().list(Context.NONE); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..06749f426559 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.generated; + +import com.azure.resourcemanager.hybridcompute.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.hybridcompute.models.PrivateLinkServiceConnectionStateProperty; + +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateEndpointConnectionUpdate.json + */ + /** + * Sample code: Approve or reject a private endpoint connection with a given name. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .privateEndpointConnections() + .define("private-endpoint-connection-name") + .withExistingPrivateLinkScope("myResourceGroup", "myPrivateLinkScope") + .withProperties( + new PrivateEndpointConnectionProperties() + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionStateProperty() + .withStatus("Approved") + .withDescription("Approved by johndoe@contoso.com"))) + .create(); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 000000000000..85ec8d5299c7 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateEndpointConnectionsDeleteSamples.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.hybridcompute.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Deletes a private endpoint connection with a given name. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .privateEndpointConnections() + .delete("myResourceGroup", "myPrivateLinkScope", "private-endpoint-connection-name", Context.NONE); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateEndpointConnectionsGetSamples.java new file mode 100644 index 000000000000..381c7441fe5c --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateEndpointConnectionsGetSamples.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.hybridcompute.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateEndpointConnectionGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .privateEndpointConnections() + .getWithResponse("myResourceGroup", "myPrivateLinkScope", "private-endpoint-connection-name", Context.NONE); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateEndpointConnectionsListByPrivateLinkScopeSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateEndpointConnectionsListByPrivateLinkScopeSamples.java new file mode 100644 index 000000000000..ffc40748211c --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateEndpointConnectionsListByPrivateLinkScopeSamples.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.hybridcompute.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections ListByPrivateLinkScope. */ +public final class PrivateEndpointConnectionsListByPrivateLinkScopeSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateEndpointConnectionList.json + */ + /** + * Sample code: Gets list of private endpoint connections on a private link scope. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void getsListOfPrivateEndpointConnectionsOnAPrivateLinkScope( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .privateEndpointConnections() + .listByPrivateLinkScope("myResourceGroup", "myPrivateLinkScope", Context.NONE); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkResourcesGetSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkResourcesGetSamples.java new file mode 100644 index 000000000000..66c4dc24553e --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkResourcesGetSamples.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.hybridcompute.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources Get. */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopePrivateLinkResourceGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .privateLinkResources() + .getWithResponse("myResourceGroup", "myPrivateLinkScope", "hybridcompute", Context.NONE); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkResourcesListByPrivateLinkScopeSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkResourcesListByPrivateLinkScopeSamples.java new file mode 100644 index 000000000000..3a72b17fce46 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkResourcesListByPrivateLinkScopeSamples.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.hybridcompute.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources ListByPrivateLinkScope. */ +public final class PrivateLinkResourcesListByPrivateLinkScopeSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopePrivateLinkResourceListGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager.privateLinkResources().listByPrivateLinkScope("myResourceGroup", "myPrivateLinkScope", Context.NONE); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesCreateOrUpdateSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..5afe1a225805 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesCreateOrUpdateSamples.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.generated; + +import java.util.HashMap; +import java.util.Map; + +/** Samples for PrivateLinkScopes CreateOrUpdate. */ +public final class PrivateLinkScopesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopesCreate.json + */ + /** + * Sample code: PrivateLinkScopeCreate. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void privateLinkScopeCreate(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .privateLinkScopes() + .define("my-privatelinkscope") + .withRegion("westus") + .withExistingResourceGroup("my-resource-group") + .create(); + } + + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopesUpdate.json + */ + /** + * Sample code: PrivateLinkScopeUpdate. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void privateLinkScopeUpdate(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .privateLinkScopes() + .define("my-privatelinkscope") + .withRegion("westus") + .withExistingResourceGroup("my-resource-group") + .withTags(mapOf("Tag1", "Value1")) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesDeleteSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesDeleteSamples.java new file mode 100644 index 000000000000..97d96c53f079 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesDeleteSamples.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.hybridcompute.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopes Delete. */ +public final class PrivateLinkScopesDeleteSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopesDelete.json + */ + /** + * Sample code: PrivateLinkScopesDelete. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void privateLinkScopesDelete(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager.privateLinkScopes().delete("my-resource-group", "my-privatelinkscope", Context.NONE); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesGetByResourceGroupSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesGetByResourceGroupSamples.java new file mode 100644 index 000000000000..62ff3f4b9c6f --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesGetByResourceGroupSamples.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.hybridcompute.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopes GetByResourceGroup. */ +public final class PrivateLinkScopesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopesGet.json + */ + /** + * Sample code: PrivateLinkScopeGet. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void privateLinkScopeGet(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .privateLinkScopes() + .getByResourceGroupWithResponse("my-resource-group", "my-privatelinkscope", Context.NONE); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesGetValidationDetailsForMachineSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesGetValidationDetailsForMachineSamples.java new file mode 100644 index 000000000000..7d7c7bf3b021 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesGetValidationDetailsForMachineSamples.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.hybridcompute.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopes GetValidationDetailsForMachine. */ +public final class PrivateLinkScopesGetValidationDetailsForMachineSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopesGetValidationForMachine.json + */ + /** + * Sample code: PrivateLinkScopeGet. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void privateLinkScopeGet(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .privateLinkScopes() + .getValidationDetailsForMachineWithResponse("my-resource-group", "machineName", Context.NONE); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesGetValidationDetailsSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesGetValidationDetailsSamples.java new file mode 100644 index 000000000000..b64740b0bc62 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesGetValidationDetailsSamples.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.hybridcompute.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopes GetValidationDetails. */ +public final class PrivateLinkScopesGetValidationDetailsSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopesGetValidation.json + */ + /** + * Sample code: PrivateLinkScopeGet. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void privateLinkScopeGet(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .privateLinkScopes() + .getValidationDetailsWithResponse("wus2", "f5dc51d3-92ed-4d7e-947a-775ea79b4919", Context.NONE); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesListByResourceGroupSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesListByResourceGroupSamples.java new file mode 100644 index 000000000000..944ded2f8f90 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesListByResourceGroupSamples.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.hybridcompute.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopes ListByResourceGroup. */ +public final class PrivateLinkScopesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopesListByResourceGroup.json + */ + /** + * Sample code: PrivateLinkScopeListByResourceGroup. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void privateLinkScopeListByResourceGroup( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager.privateLinkScopes().listByResourceGroup("my-resource-group", Context.NONE); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesListSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesListSamples.java new file mode 100644 index 000000000000..cdbccae37fbd --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesListSamples.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.hybridcompute.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopes List. */ +public final class PrivateLinkScopesListSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopesList.json + */ + /** + * Sample code: PrivateLinkScopesList.json. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void privateLinkScopesListJson(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager.privateLinkScopes().list(Context.NONE); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesUpdateTagsSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesUpdateTagsSamples.java new file mode 100644 index 000000000000..2545d415b669 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/PrivateLinkScopesUpdateTagsSamples.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.hybridcompute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.hybridcompute.models.HybridComputePrivateLinkScope; +import java.util.HashMap; +import java.util.Map; + +/** Samples for PrivateLinkScopes UpdateTags. */ +public final class PrivateLinkScopesUpdateTagsSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/PrivateLinkScopesUpdateTagsOnly.json + */ + /** + * Sample code: PrivateLinkScopeUpdateTagsOnly. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void privateLinkScopeUpdateTagsOnly( + com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + HybridComputePrivateLinkScope resource = + manager + .privateLinkScopes() + .getByResourceGroupWithResponse("my-resource-group", "my-privatelinkscope", 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/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/ResourceProviderUpgradeExtensionsSamples.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/ResourceProviderUpgradeExtensionsSamples.java new file mode 100644 index 000000000000..4cb20ec40260 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/samples/java/com/azure/resourcemanager/hybridcompute/generated/ResourceProviderUpgradeExtensionsSamples.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.hybridcompute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.hybridcompute.models.ExtensionTargetProperties; +import com.azure.resourcemanager.hybridcompute.models.MachineExtensionUpgrade; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ResourceProvider UpgradeExtensions. */ +public final class ResourceProviderUpgradeExtensionsSamples { + /* + * x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2021-06-10-preview/examples/Extensions_Upgrade.json + */ + /** + * Sample code: Upgrade Machine Extensions. + * + * @param manager Entry point to HybridComputeManager. + */ + public static void upgradeMachineExtensions(com.azure.resourcemanager.hybridcompute.HybridComputeManager manager) { + manager + .resourceProviders() + .upgradeExtensions( + "myResourceGroup", + "myMachine", + new MachineExtensionUpgrade() + .withExtensionTargets( + mapOf( + "Microsoft.Azure.Monitoring", + new ExtensionTargetProperties().withTargetVersion("2.0"), + "Microsoft.Compute.CustomScriptExtension", + new ExtensionTargetProperties().withTargetVersion("1.10"))), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +}