diff --git a/sdk/resourcemanager/azure-resourcemanager-compute/pom.xml b/sdk/resourcemanager/azure-resourcemanager-compute/pom.xml index 49da3386a3b5c..e370281a0a757 100644 --- a/sdk/resourcemanager/azure-resourcemanager-compute/pom.xml +++ b/sdk/resourcemanager/azure-resourcemanager-compute/pom.xml @@ -195,6 +195,8 @@ revapi-maven-plugin 0.11.2 + true + diff --git a/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/VirtualMachinesClient.java b/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/VirtualMachinesClient.java index d7c64d3a004d0..76edfa257c5a2 100644 --- a/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/VirtualMachinesClient.java +++ b/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/VirtualMachinesClient.java @@ -414,7 +414,7 @@ VirtualMachineInner update( * * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. - * @param forceDeletion Optional parameter to force delete virtual machines.(Feature in Preview). + * @param forceDeletion Optional parameter to force delete virtual machines. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -429,7 +429,7 @@ Mono>> deleteWithResponseAsync( * * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. - * @param forceDeletion Optional parameter to force delete virtual machines.(Feature in Preview). + * @param forceDeletion Optional parameter to force delete virtual machines. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -443,7 +443,7 @@ Mono>> deleteWithResponseAsync( * * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. - * @param forceDeletion Optional parameter to force delete virtual machines.(Feature in Preview). + * @param forceDeletion Optional parameter to force delete virtual machines. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -457,7 +457,7 @@ Mono>> deleteWithResponseAsync( * * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. - * @param forceDeletion Optional parameter to force delete virtual machines.(Feature in Preview). + * @param forceDeletion Optional parameter to force delete virtual machines. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -473,7 +473,7 @@ SyncPoller, Void> beginDelete( * * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. - * @param forceDeletion Optional parameter to force delete virtual machines.(Feature in Preview). + * @param forceDeletion Optional parameter to force delete virtual machines. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -500,7 +500,7 @@ SyncPoller, Void> beginDelete( * * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. - * @param forceDeletion Optional parameter to force delete virtual machines.(Feature in Preview). + * @param forceDeletion Optional parameter to force delete virtual machines. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -525,7 +525,7 @@ SyncPoller, Void> beginDelete( * * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. - * @param forceDeletion Optional parameter to force delete virtual machines.(Feature in Preview). + * @param forceDeletion Optional parameter to force delete virtual machines. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. diff --git a/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/models/RestorePointInner.java b/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/models/RestorePointInner.java index b5852b7a1a01d..830365655f39f 100644 --- a/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/models/RestorePointInner.java +++ b/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/models/RestorePointInner.java @@ -9,10 +9,10 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.compute.models.ApiEntityReference; import com.azure.resourcemanager.compute.models.ConsistencyModeTypes; -import com.azure.resourcemanager.compute.models.RestorePointProvisioningDetails; import com.azure.resourcemanager.compute.models.RestorePointSourceMetadata; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; import java.util.List; /** Restore Point details. */ @@ -89,13 +89,26 @@ public ConsistencyModeTypes consistencyMode() { } /** - * Get the provisioningDetails property: Gets the provisioning details set by the server during Create restore point - * operation. + * Get the timeCreated property: Gets the creation time of the restore point. * - * @return the provisioningDetails value. + * @return the timeCreated value. */ - public RestorePointProvisioningDetails provisioningDetails() { - return this.innerProperties() == null ? null : this.innerProperties().provisioningDetails(); + public OffsetDateTime timeCreated() { + return this.innerProperties() == null ? null : this.innerProperties().timeCreated(); + } + + /** + * Set the timeCreated property: Gets the creation time of the restore point. + * + * @param timeCreated the timeCreated value to set. + * @return the RestorePointInner object itself. + */ + public RestorePointInner withTimeCreated(OffsetDateTime timeCreated) { + if (this.innerProperties() == null) { + this.innerProperties = new RestorePointProperties(); + } + this.innerProperties().withTimeCreated(timeCreated); + return this; } /** diff --git a/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/models/RestorePointProperties.java b/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/models/RestorePointProperties.java index b557007f5f90b..d1315f85fc1f0 100644 --- a/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/models/RestorePointProperties.java +++ b/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/models/RestorePointProperties.java @@ -8,10 +8,10 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.compute.models.ApiEntityReference; import com.azure.resourcemanager.compute.models.ConsistencyModeTypes; -import com.azure.resourcemanager.compute.models.RestorePointProvisioningDetails; import com.azure.resourcemanager.compute.models.RestorePointSourceMetadata; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; import java.util.List; /** The restore point properties. */ @@ -47,11 +47,10 @@ public final class RestorePointProperties { private ConsistencyModeTypes consistencyMode; /* - * Gets the provisioning details set by the server during Create restore - * point operation. + * Gets the creation time of the restore point. */ - @JsonProperty(value = "provisioningDetails", access = JsonProperty.Access.WRITE_ONLY) - private RestorePointProvisioningDetails provisioningDetails; + @JsonProperty(value = "timeCreated") + private OffsetDateTime timeCreated; /** * Get the excludeDisks property: List of disk resource ids that the customer wishes to exclude from the restore @@ -104,13 +103,23 @@ public ConsistencyModeTypes consistencyMode() { } /** - * Get the provisioningDetails property: Gets the provisioning details set by the server during Create restore point - * operation. + * Get the timeCreated property: Gets the creation time of the restore point. * - * @return the provisioningDetails value. + * @return the timeCreated value. */ - public RestorePointProvisioningDetails provisioningDetails() { - return this.provisioningDetails; + public OffsetDateTime timeCreated() { + return this.timeCreated; + } + + /** + * Set the timeCreated property: Gets the creation time of the restore point. + * + * @param timeCreated the timeCreated value to set. + * @return the RestorePointProperties object itself. + */ + public RestorePointProperties withTimeCreated(OffsetDateTime timeCreated) { + this.timeCreated = timeCreated; + return this; } /** @@ -125,8 +134,5 @@ public void validate() { if (sourceMetadata() != null) { sourceMetadata().validate(); } - if (provisioningDetails() != null) { - provisioningDetails().validate(); - } } } diff --git a/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/implementation/VirtualMachinesClientImpl.java b/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/implementation/VirtualMachinesClientImpl.java index 1174e59aae433..72a8f0db3373b 100644 --- a/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/implementation/VirtualMachinesClientImpl.java +++ b/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/implementation/VirtualMachinesClientImpl.java @@ -1477,7 +1477,7 @@ public VirtualMachineInner update( * * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. - * @param forceDeletion Optional parameter to force delete virtual machines.(Feature in Preview). + * @param forceDeletion Optional parameter to force delete virtual machines. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1526,7 +1526,7 @@ public Mono>> deleteWithResponseAsync( * * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. - * @param forceDeletion Optional parameter to force delete virtual machines.(Feature in Preview). + * @param forceDeletion Optional parameter to force delete virtual machines. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1573,7 +1573,7 @@ private Mono>> deleteWithResponseAsync( * * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. - * @param forceDeletion Optional parameter to force delete virtual machines.(Feature in Preview). + * @param forceDeletion Optional parameter to force delete virtual machines. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1593,7 +1593,7 @@ public PollerFlux, Void> beginDeleteAsync( * * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. - * @param forceDeletion Optional parameter to force delete virtual machines.(Feature in Preview). + * @param forceDeletion Optional parameter to force delete virtual machines. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1616,7 +1616,7 @@ private PollerFlux, Void> beginDeleteAsync( * * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. - * @param forceDeletion Optional parameter to force delete virtual machines.(Feature in Preview). + * @param forceDeletion Optional parameter to force delete virtual machines. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1633,7 +1633,7 @@ public SyncPoller, Void> beginDelete( * * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. - * @param forceDeletion Optional parameter to force delete virtual machines.(Feature in Preview). + * @param forceDeletion Optional parameter to force delete virtual machines. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1651,7 +1651,7 @@ public SyncPoller, Void> beginDelete( * * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. - * @param forceDeletion Optional parameter to force delete virtual machines.(Feature in Preview). + * @param forceDeletion Optional parameter to force delete virtual machines. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1687,7 +1687,7 @@ public Mono deleteAsync(String resourceGroupName, String vmName) { * * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. - * @param forceDeletion Optional parameter to force delete virtual machines.(Feature in Preview). + * @param forceDeletion Optional parameter to force delete virtual machines. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1706,7 +1706,7 @@ private Mono deleteAsync(String resourceGroupName, String vmName, Boolean * * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. - * @param forceDeletion Optional parameter to force delete virtual machines.(Feature in Preview). + * @param forceDeletion Optional parameter to force delete virtual machines. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1736,7 +1736,7 @@ public void delete(String resourceGroupName, String vmName) { * * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. - * @param forceDeletion Optional parameter to force delete virtual machines.(Feature in Preview). + * @param forceDeletion Optional parameter to force delete virtual machines. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/models/DiagnosticsProfile.java b/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/models/DiagnosticsProfile.java index 3a548af587e06..3a57aa31c6455 100644 --- a/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/models/DiagnosticsProfile.java +++ b/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/models/DiagnosticsProfile.java @@ -16,17 +16,21 @@ public final class DiagnosticsProfile { /* * Boot Diagnostics is a debugging feature which allows you to view Console - * Output and Screenshot to diagnose VM status.

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

Azure also enables you to - * see a screenshot of the VM from the hypervisor. + * Output and Screenshot to diagnose VM status.
**NOTE**: If storageUri + * is being specified then ensure that the storage account is in the same + * region and subscription as the VM.

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

Azure also enables you to see a + * screenshot of the VM from the hypervisor. */ @JsonProperty(value = "bootDiagnostics") private BootDiagnostics bootDiagnostics; /** * Get the bootDiagnostics property: Boot Diagnostics is a debugging feature which allows you to view Console Output - * and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. - * <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. + * and Screenshot to diagnose VM status. <br>**NOTE**: If storageUri is being specified then ensure that the + * storage account is in the same region and subscription as the VM. <br><br> You can easily view the + * output of your console log. <br><br> Azure also enables you to see a screenshot of the VM from the + * hypervisor. * * @return the bootDiagnostics value. */ @@ -36,8 +40,10 @@ public BootDiagnostics bootDiagnostics() { /** * Set the bootDiagnostics property: Boot Diagnostics is a debugging feature which allows you to view Console Output - * and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. - * <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. + * and Screenshot to diagnose VM status. <br>**NOTE**: If storageUri is being specified then ensure that the + * storage account is in the same region and subscription as the VM. <br><br> You can easily view the + * output of your console log. <br><br> Azure also enables you to see a screenshot of the VM from the + * hypervisor. * * @param bootDiagnostics the bootDiagnostics value to set. * @return the DiagnosticsProfile object itself. diff --git a/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/models/RestorePointProvisioningDetails.java b/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/models/RestorePointProvisioningDetails.java deleted file mode 100644 index 1429508c95fb0..0000000000000 --- a/sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/models/RestorePointProvisioningDetails.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.compute.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.time.OffsetDateTime; - -/** Restore Point Provisioning details. */ -@Fluent -public final class RestorePointProvisioningDetails { - @JsonIgnore private final ClientLogger logger = new ClientLogger(RestorePointProvisioningDetails.class); - - /* - * Gets the creation time of the restore point. - */ - @JsonProperty(value = "creationTime") - private OffsetDateTime creationTime; - - /* - * Gets the total size of the data in all the disks which are part of the - * restore point. - */ - @JsonProperty(value = "totalUsedSizeInBytes") - private Long totalUsedSizeInBytes; - - /* - * Gets the status of the Create restore point operation. - */ - @JsonProperty(value = "statusCode") - private Integer statusCode; - - /* - * Gets the status message of the Create restore point operation. - */ - @JsonProperty(value = "statusMessage") - private String statusMessage; - - /** - * Get the creationTime property: Gets the creation time of the restore point. - * - * @return the creationTime value. - */ - public OffsetDateTime creationTime() { - return this.creationTime; - } - - /** - * Set the creationTime property: Gets the creation time of the restore point. - * - * @param creationTime the creationTime value to set. - * @return the RestorePointProvisioningDetails object itself. - */ - public RestorePointProvisioningDetails withCreationTime(OffsetDateTime creationTime) { - this.creationTime = creationTime; - return this; - } - - /** - * Get the totalUsedSizeInBytes property: Gets the total size of the data in all the disks which are part of the - * restore point. - * - * @return the totalUsedSizeInBytes value. - */ - public Long totalUsedSizeInBytes() { - return this.totalUsedSizeInBytes; - } - - /** - * Set the totalUsedSizeInBytes property: Gets the total size of the data in all the disks which are part of the - * restore point. - * - * @param totalUsedSizeInBytes the totalUsedSizeInBytes value to set. - * @return the RestorePointProvisioningDetails object itself. - */ - public RestorePointProvisioningDetails withTotalUsedSizeInBytes(Long totalUsedSizeInBytes) { - this.totalUsedSizeInBytes = totalUsedSizeInBytes; - return this; - } - - /** - * Get the statusCode property: Gets the status of the Create restore point operation. - * - * @return the statusCode value. - */ - public Integer statusCode() { - return this.statusCode; - } - - /** - * Set the statusCode property: Gets the status of the Create restore point operation. - * - * @param statusCode the statusCode value to set. - * @return the RestorePointProvisioningDetails object itself. - */ - public RestorePointProvisioningDetails withStatusCode(Integer statusCode) { - this.statusCode = statusCode; - return this; - } - - /** - * Get the statusMessage property: Gets the status message of the Create restore point operation. - * - * @return the statusMessage value. - */ - public String statusMessage() { - return this.statusMessage; - } - - /** - * Set the statusMessage property: Gets the status message of the Create restore point operation. - * - * @param statusMessage the statusMessage value to set. - * @return the RestorePointProvisioningDetails object itself. - */ - public RestorePointProvisioningDetails withStatusMessage(String statusMessage) { - this.statusMessage = statusMessage; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/AvailabilitySetsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/AvailabilitySetsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..37dccfd5aba65 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/AvailabilitySetsCreateOrUpdateSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.AvailabilitySetInner; + +/** Samples for AvailabilitySets CreateOrUpdate. */ +public final class AvailabilitySetsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAnAvailabilitySet.json + */ + /** + * Sample code: Create an availability set. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAnAvailabilitySet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getAvailabilitySets() + .createOrUpdateWithResponse( + "myResourceGroup", + "myAvailabilitySet", + new AvailabilitySetInner() + .withLocation("westus") + .withPlatformUpdateDomainCount(20) + .withPlatformFaultDomainCount(2), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/AvailabilitySetsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/AvailabilitySetsListSamples.java new file mode 100644 index 0000000000000..e21a6e63be29a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/AvailabilitySetsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for AvailabilitySets List. */ +public final class AvailabilitySetsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/ListAvailabilitySetsInASubscription.json + */ + /** + * Sample code: List availability sets in a subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAvailabilitySetsInASubscription(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getAvailabilitySets() + .list("virtualMachines\\$ref", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CapacityReservationGroupsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CapacityReservationGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e563e3f491c23 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CapacityReservationGroupsCreateOrUpdateSamples.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.CapacityReservationGroupInner; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CapacityReservationGroups CreateOrUpdate. */ +public final class CapacityReservationGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateOrUpdateACapacityReservationGroup.json + */ + /** + * Sample code: Create or update a capacity reservation group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateACapacityReservationGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCapacityReservationGroups() + .createOrUpdateWithResponse( + "myResourceGroup", + "myCapacityReservationGroup", + new CapacityReservationGroupInner() + .withLocation("westus") + .withTags(mapOf("department", "finance")) + .withZones(Arrays.asList("1", "2")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CapacityReservationGroupsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CapacityReservationGroupsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..991ec1183c5a8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CapacityReservationGroupsGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CapacityReservationGroups GetByResourceGroup. */ +public final class CapacityReservationGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GetACapacityReservationGroup.json + */ + /** + * Sample code: Get a capacity reservation Group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getACapacityReservationGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCapacityReservationGroups() + .getByResourceGroupWithResponse("myResourceGroup", "myCapacityReservationGroup", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CapacityReservationGroupsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CapacityReservationGroupsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..7c85c18e17278 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CapacityReservationGroupsListByResourceGroupSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.ExpandTypesForGetCapacityReservationGroups; + +/** Samples for CapacityReservationGroups ListByResourceGroup. */ +public final class CapacityReservationGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/ListCapacityReservationGroupsInResourceGroup.json + */ + /** + * Sample code: List capacity reservation groups in resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listCapacityReservationGroupsInResourceGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCapacityReservationGroups() + .listByResourceGroup( + "myResourceGroup", ExpandTypesForGetCapacityReservationGroups.VIRTUAL_MACHINES_REF, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CapacityReservationGroupsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CapacityReservationGroupsListSamples.java new file mode 100644 index 0000000000000..218029cd2136f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CapacityReservationGroupsListSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.ExpandTypesForGetCapacityReservationGroups; + +/** Samples for CapacityReservationGroups List. */ +public final class CapacityReservationGroupsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/ListCapacityReservationGroupsInSubscription.json + */ + /** + * Sample code: List capacity reservation groups in subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listCapacityReservationGroupsInSubscription( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCapacityReservationGroups() + .list(ExpandTypesForGetCapacityReservationGroups.VIRTUAL_MACHINES_REF, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CapacityReservationsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CapacityReservationsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..ec27bc1759c08 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CapacityReservationsCreateOrUpdateSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.CapacityReservationInner; +import com.azure.resourcemanager.compute.models.Sku; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CapacityReservations CreateOrUpdate. */ +public final class CapacityReservationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateOrUpdateACapacityReservation.json + */ + /** + * Sample code: Create or update a capacity reservation . + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateACapacityReservation(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCapacityReservations() + .createOrUpdate( + "myResourceGroup", + "myCapacityReservationGroup", + "myCapacityReservation", + new CapacityReservationInner() + .withLocation("westus") + .withTags(mapOf("department", "HR")) + .withSku(new Sku().withName("Standard_DS1_v2").withCapacity(4L)) + .withZones(Arrays.asList("1")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CapacityReservationsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CapacityReservationsGetSamples.java new file mode 100644 index 0000000000000..a3e3b40482925 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CapacityReservationsGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CapacityReservations Get. */ +public final class CapacityReservationsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GetACapacityReservation.json + */ + /** + * Sample code: Get a capacity reservation. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getACapacityReservation(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCapacityReservations() + .getWithResponse( + "myResourceGroup", "myCapacityReservationGroup", "myCapacityReservation", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CapacityReservationsListByCapacityReservationGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CapacityReservationsListByCapacityReservationGroupSamples.java new file mode 100644 index 0000000000000..bda64be28354d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CapacityReservationsListByCapacityReservationGroupSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CapacityReservations ListByCapacityReservationGroup. */ +public final class CapacityReservationsListByCapacityReservationGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/ListCapacityReservationsInReservationGroup.json + */ + /** + * Sample code: List capacity reservations in reservation group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listCapacityReservationsInReservationGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCapacityReservations() + .listByCapacityReservationGroup("myResourceGroup", "myCapacityReservationGroup", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceOperatingSystemsGetOSFamilySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceOperatingSystemsGetOSFamilySamples.java new file mode 100644 index 0000000000000..bdc148b9b948a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceOperatingSystemsGetOSFamilySamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceOperatingSystems GetOSFamily. */ +public final class CloudServiceOperatingSystemsGetOSFamilySamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetCloudServiceOSFamily.json + */ + /** + * Sample code: Get Cloud Service OS Family. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getCloudServiceOSFamily(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServiceOperatingSystems() + .getOSFamilyWithResponse("westus2", "3", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceOperatingSystemsGetOSVersionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceOperatingSystemsGetOSVersionSamples.java new file mode 100644 index 0000000000000..617c17575ea05 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceOperatingSystemsGetOSVersionSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceOperatingSystems GetOSVersion. */ +public final class CloudServiceOperatingSystemsGetOSVersionSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetCloudServiceOSVersion.json + */ + /** + * Sample code: Get Cloud Service OS Version. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getCloudServiceOSVersion(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServiceOperatingSystems() + .getOSVersionWithResponse("westus2", "WA-GUEST-OS-3.90_202010-02", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceOperatingSystemsListOSFamiliesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceOperatingSystemsListOSFamiliesSamples.java new file mode 100644 index 0000000000000..b10c9670fa470 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceOperatingSystemsListOSFamiliesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceOperatingSystems ListOSFamilies. */ +public final class CloudServiceOperatingSystemsListOSFamiliesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ListCloudServiceOSFamilies.json + */ + /** + * Sample code: List Cloud Service OS Families in a subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listCloudServiceOSFamiliesInASubscription(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServiceOperatingSystems() + .listOSFamilies("westus2", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceOperatingSystemsListOSVersionsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceOperatingSystemsListOSVersionsSamples.java new file mode 100644 index 0000000000000..4e67d26b63b62 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceOperatingSystemsListOSVersionsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceOperatingSystems ListOSVersions. */ +public final class CloudServiceOperatingSystemsListOSVersionsSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ListCloudServiceOSVersions.json + */ + /** + * Sample code: List Cloud Service OS Versions in a subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listCloudServiceOSVersionsInASubscription(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServiceOperatingSystems() + .listOSVersions("westus2", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRoleInstancesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRoleInstancesDeleteSamples.java new file mode 100644 index 0000000000000..612db0650e0f1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRoleInstancesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoleInstances Delete. */ +public final class CloudServiceRoleInstancesDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/DeleteCloudServiceRoleInstance.json + */ + /** + * Sample code: Delete Cloud Service Role Instance. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteCloudServiceRoleInstance(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServiceRoleInstances() + .delete("{roleInstance-name}", "ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRoleInstancesGetInstanceViewSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRoleInstancesGetInstanceViewSamples.java new file mode 100644 index 0000000000000..af28922196f8b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRoleInstancesGetInstanceViewSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoleInstances GetInstanceView. */ +public final class CloudServiceRoleInstancesGetInstanceViewSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetInstanceViewOfCloudServiceRoleInstance.json + */ + /** + * Sample code: Get Instance View of Cloud Service Role Instance. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getInstanceViewOfCloudServiceRoleInstance(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServiceRoleInstances() + .getInstanceViewWithResponse("{roleInstance-name}", "ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRoleInstancesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRoleInstancesGetSamples.java new file mode 100644 index 0000000000000..72c4877e1d7ab --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRoleInstancesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoleInstances Get. */ +public final class CloudServiceRoleInstancesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetCloudServiceRoleInstance.json + */ + /** + * Sample code: Get Cloud Service Role Instance. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getCloudServiceRoleInstance(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServiceRoleInstances() + .getWithResponse("{roleInstance-name}", "ConstosoRG", "{cs-name}", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRoleInstancesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRoleInstancesListSamples.java new file mode 100644 index 0000000000000..97b483f3d57f8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRoleInstancesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoleInstances List. */ +public final class CloudServiceRoleInstancesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ListCloudServiceRolesInstances.json + */ + /** + * Sample code: List Role Instances in a Cloud Service. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listRoleInstancesInACloudService(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServiceRoleInstances() + .list("ConstosoRG", "{cs-name}", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRoleInstancesRebuildSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRoleInstancesRebuildSamples.java new file mode 100644 index 0000000000000..dffc6f7609f07 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRoleInstancesRebuildSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoleInstances Rebuild. */ +public final class CloudServiceRoleInstancesRebuildSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/RebuildCloudServiceRoleInstance.json + */ + /** + * Sample code: Rebuild Cloud Service Role Instance. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void rebuildCloudServiceRoleInstance(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServiceRoleInstances() + .rebuild("{roleInstance-name}", "ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRoleInstancesReimageSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRoleInstancesReimageSamples.java new file mode 100644 index 0000000000000..7268860c06f1e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRoleInstancesReimageSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoleInstances Reimage. */ +public final class CloudServiceRoleInstancesReimageSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ReimageCloudServiceRoleInstance.json + */ + /** + * Sample code: Reimage Cloud Service Role Instance. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void reimageCloudServiceRoleInstance(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServiceRoleInstances() + .reimage("{roleInstance-name}", "ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRoleInstancesRestartSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRoleInstancesRestartSamples.java new file mode 100644 index 0000000000000..08f2ae8e0023e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRoleInstancesRestartSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoleInstances Restart. */ +public final class CloudServiceRoleInstancesRestartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/RestartCloudServiceRoleInstance.json + */ + /** + * Sample code: Restart Cloud Service Role Instance. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void restartCloudServiceRoleInstance(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServiceRoleInstances() + .restart("{roleInstance-name}", "ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRolesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRolesGetSamples.java new file mode 100644 index 0000000000000..b9ba6d8c4f548 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRolesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoles Get. */ +public final class CloudServiceRolesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetCloudServiceRole.json + */ + /** + * Sample code: Get Cloud Service Role. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getCloudServiceRole(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServiceRoles() + .getWithResponse("{role-name}", "ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRolesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRolesListSamples.java new file mode 100644 index 0000000000000..185b5339e4ca3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServiceRolesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServiceRoles List. */ +public final class CloudServiceRolesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ListCloudServiceRoles.json + */ + /** + * Sample code: List Roles in a Cloud Service. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listRolesInACloudService(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServiceRoles() + .list("ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e47c601299fe7 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesCreateOrUpdateSamples.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.CloudServiceInner; +import com.azure.resourcemanager.compute.models.CloudServiceExtensionProfile; +import com.azure.resourcemanager.compute.models.CloudServiceExtensionProperties; +import com.azure.resourcemanager.compute.models.CloudServiceNetworkProfile; +import com.azure.resourcemanager.compute.models.CloudServiceOsProfile; +import com.azure.resourcemanager.compute.models.CloudServiceProperties; +import com.azure.resourcemanager.compute.models.CloudServiceRoleProfile; +import com.azure.resourcemanager.compute.models.CloudServiceRoleProfileProperties; +import com.azure.resourcemanager.compute.models.CloudServiceRoleSku; +import com.azure.resourcemanager.compute.models.CloudServiceUpgradeMode; +import com.azure.resourcemanager.compute.models.CloudServiceVaultCertificate; +import com.azure.resourcemanager.compute.models.CloudServiceVaultSecretGroup; +import com.azure.resourcemanager.compute.models.Extension; +import com.azure.resourcemanager.compute.models.LoadBalancerConfiguration; +import com.azure.resourcemanager.compute.models.LoadBalancerConfigurationProperties; +import com.azure.resourcemanager.compute.models.LoadBalancerFrontendIpConfiguration; +import com.azure.resourcemanager.compute.models.LoadBalancerFrontendIpConfigurationProperties; +import java.util.Arrays; + +/** Samples for CloudServices CreateOrUpdate. */ +public final class CloudServicesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/CreateCloudServiceWithSingleRole.json + */ + /** + * Sample code: Create New Cloud Service with Single Role. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createNewCloudServiceWithSingleRole(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServices() + .createOrUpdate( + "ConstosoRG", + "{cs-name}", + new CloudServiceInner() + .withLocation("westus") + .withProperties( + new CloudServiceProperties() + .withPackageUrl("{PackageUrl}") + .withConfiguration("{ServiceConfiguration}") + .withUpgradeMode(CloudServiceUpgradeMode.AUTO) + .withRoleProfile( + new CloudServiceRoleProfile() + .withRoles( + Arrays + .asList( + new CloudServiceRoleProfileProperties() + .withName("ContosoFrontend") + .withSku( + new CloudServiceRoleSku() + .withName("Standard_D1_v2") + .withTier("Standard") + .withCapacity(1L))))) + .withNetworkProfile( + new CloudServiceNetworkProfile() + .withLoadBalancerConfigurations( + Arrays + .asList( + new LoadBalancerConfiguration() + .withName("myLoadBalancer") + .withProperties( + new LoadBalancerConfigurationProperties() + .withFrontendIpConfigurations( + Arrays + .asList( + new LoadBalancerFrontendIpConfiguration() + .withName("myfe") + .withProperties( + new LoadBalancerFrontendIpConfigurationProperties() + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/myPublicIP")))))))))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/CreateCloudServiceWithSingleRoleAndCertificate.json + */ + /** + * Sample code: Create New Cloud Service with Single Role and Certificate from Key Vault. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createNewCloudServiceWithSingleRoleAndCertificateFromKeyVault( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServices() + .createOrUpdate( + "ConstosoRG", + "{cs-name}", + new CloudServiceInner() + .withLocation("westus") + .withProperties( + new CloudServiceProperties() + .withPackageUrl("{PackageUrl}") + .withConfiguration("{ServiceConfiguration}") + .withUpgradeMode(CloudServiceUpgradeMode.AUTO) + .withRoleProfile( + new CloudServiceRoleProfile() + .withRoles( + Arrays + .asList( + new CloudServiceRoleProfileProperties() + .withName("ContosoFrontend") + .withSku( + new CloudServiceRoleSku() + .withName("Standard_D1_v2") + .withTier("Standard") + .withCapacity(1L))))) + .withOsProfile( + new CloudServiceOsProfile() + .withSecrets( + Arrays + .asList( + new CloudServiceVaultSecretGroup() + .withSourceVault( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.KeyVault/vaults/{keyvault-name}")) + .withVaultCertificates( + Arrays + .asList( + new CloudServiceVaultCertificate() + .withCertificateUrl( + "https://{keyvault-name}.vault.azure.net:443/secrets/ContosoCertificate/{secret-id}")))))) + .withNetworkProfile( + new CloudServiceNetworkProfile() + .withLoadBalancerConfigurations( + Arrays + .asList( + new LoadBalancerConfiguration() + .withName("contosolb") + .withProperties( + new LoadBalancerConfigurationProperties() + .withFrontendIpConfigurations( + Arrays + .asList( + new LoadBalancerFrontendIpConfiguration() + .withName("contosofe") + .withProperties( + new LoadBalancerFrontendIpConfigurationProperties() + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip")))))))))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/CreateCloudServiceWithSingleRoleAndRDP.json + */ + /** + * Sample code: Create New Cloud Service with Single Role and RDP Extension. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createNewCloudServiceWithSingleRoleAndRDPExtension( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServices() + .createOrUpdate( + "ConstosoRG", + "{cs-name}", + new CloudServiceInner() + .withLocation("westus") + .withProperties( + new CloudServiceProperties() + .withPackageUrl("{PackageUrl}") + .withConfiguration("{ServiceConfiguration}") + .withUpgradeMode(CloudServiceUpgradeMode.AUTO) + .withRoleProfile( + new CloudServiceRoleProfile() + .withRoles( + Arrays + .asList( + new CloudServiceRoleProfileProperties() + .withName("ContosoFrontend") + .withSku( + new CloudServiceRoleSku() + .withName("Standard_D1_v2") + .withTier("Standard") + .withCapacity(1L))))) + .withNetworkProfile( + new CloudServiceNetworkProfile() + .withLoadBalancerConfigurations( + Arrays + .asList( + new LoadBalancerConfiguration() + .withName("contosolb") + .withProperties( + new LoadBalancerConfigurationProperties() + .withFrontendIpConfigurations( + Arrays + .asList( + new LoadBalancerFrontendIpConfiguration() + .withName("contosofe") + .withProperties( + new LoadBalancerFrontendIpConfigurationProperties() + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip"))))))))) + .withExtensionProfile( + new CloudServiceExtensionProfile() + .withExtensions( + Arrays + .asList( + new Extension() + .withName("RDPExtension") + .withProperties( + new CloudServiceExtensionProperties() + .withPublisher("Microsoft.Windows.Azure.Extensions") + .withType("RDP") + .withTypeHandlerVersion("1.2.1") + .withAutoUpgradeMinorVersion(false) + .withSettings( + "UserAzure10/22/2021" + + " 15:05:45") + .withProtectedSettings( + "{password}")))))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/CreateCloudServiceWithMultiRole.json + */ + /** + * Sample code: Create New Cloud Service with Multiple Roles. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createNewCloudServiceWithMultipleRoles(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServices() + .createOrUpdate( + "ConstosoRG", + "{cs-name}", + new CloudServiceInner() + .withLocation("westus") + .withProperties( + new CloudServiceProperties() + .withPackageUrl("{PackageUrl}") + .withConfiguration("{ServiceConfiguration}") + .withUpgradeMode(CloudServiceUpgradeMode.AUTO) + .withRoleProfile( + new CloudServiceRoleProfile() + .withRoles( + Arrays + .asList( + new CloudServiceRoleProfileProperties() + .withName("ContosoFrontend") + .withSku( + new CloudServiceRoleSku() + .withName("Standard_D1_v2") + .withTier("Standard") + .withCapacity(1L)), + new CloudServiceRoleProfileProperties() + .withName("ContosoBackend") + .withSku( + new CloudServiceRoleSku() + .withName("Standard_D1_v2") + .withTier("Standard") + .withCapacity(1L))))) + .withNetworkProfile( + new CloudServiceNetworkProfile() + .withLoadBalancerConfigurations( + Arrays + .asList( + new LoadBalancerConfiguration() + .withName("contosolb") + .withProperties( + new LoadBalancerConfigurationProperties() + .withFrontendIpConfigurations( + Arrays + .asList( + new LoadBalancerFrontendIpConfiguration() + .withName("contosofe") + .withProperties( + new LoadBalancerFrontendIpConfigurationProperties() + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip")))))))))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesDeleteInstancesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesDeleteInstancesSamples.java new file mode 100644 index 0000000000000..bf07080137690 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesDeleteInstancesSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.RoleInstances; +import java.util.Arrays; + +/** Samples for CloudServices DeleteInstances. */ +public final class CloudServicesDeleteInstancesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/DeleteCloudServiceRoleInstances.json + */ + /** + * Sample code: Delete Cloud Service Role Instances. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteCloudServiceRoleInstances(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServices() + .deleteInstances( + "ConstosoRG", + "{cs-name}", + new RoleInstances().withRoleInstances(Arrays.asList("ContosoFrontend_IN_0", "ContosoBackend_IN_1")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesDeleteSamples.java new file mode 100644 index 0000000000000..573dff49ef681 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServices Delete. */ +public final class CloudServicesDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/DeleteCloudService.json + */ + /** + * Sample code: Delete Cloud Service. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteCloudService(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServices() + .delete("ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..07d5a1bfcc52d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesGetByResourceGroupSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServices GetByResourceGroup. */ +public final class CloudServicesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetCloudServiceWithMultiRoleAndRDP.json + */ + /** + * Sample code: Get Cloud Service with Multiple Roles and RDP Extension. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getCloudServiceWithMultipleRolesAndRDPExtension( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServices() + .getByResourceGroupWithResponse("ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesGetInstanceViewSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesGetInstanceViewSamples.java new file mode 100644 index 0000000000000..193b906ef1c64 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesGetInstanceViewSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServices GetInstanceView. */ +public final class CloudServicesGetInstanceViewSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetCloudServiceInstanceViewWithMultiRole.json + */ + /** + * Sample code: Get Cloud Service Instance View with Multiple Roles. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getCloudServiceInstanceViewWithMultipleRoles( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServices() + .getInstanceViewWithResponse("ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..298ddd95341e9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesListByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServices ListByResourceGroup. */ +public final class CloudServicesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ListCloudServicesInResourceGroup.json + */ + /** + * Sample code: List Cloud Services in a Resource Group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listCloudServicesInAResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServices() + .listByResourceGroup("ConstosoRG", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesListSamples.java new file mode 100644 index 0000000000000..9764b49c372b5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServices List. */ +public final class CloudServicesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ListCloudServicesInSubscription.json + */ + /** + * Sample code: List Cloud Services in a Subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listCloudServicesInASubscription(com.azure.resourcemanager.AzureResourceManager azure) { + azure.virtualMachines().manager().serviceClient().getCloudServices().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesPowerOffSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesPowerOffSamples.java new file mode 100644 index 0000000000000..ebcbbe53200ab --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesPowerOffSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServices PowerOff. */ +public final class CloudServicesPowerOffSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/PowerOffCloudService.json + */ + /** + * Sample code: Stop or PowerOff Cloud Service. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void stopOrPowerOffCloudService(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServices() + .powerOff("ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesRebuildSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesRebuildSamples.java new file mode 100644 index 0000000000000..da127fd5e4246 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesRebuildSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.RoleInstances; +import java.util.Arrays; + +/** Samples for CloudServices Rebuild. */ +public final class CloudServicesRebuildSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/RebuildCloudServiceRoleInstances.json + */ + /** + * Sample code: Rebuild Cloud Service Role Instances. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void rebuildCloudServiceRoleInstances(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServices() + .rebuild( + "ConstosoRG", + "{cs-name}", + new RoleInstances().withRoleInstances(Arrays.asList("ContosoFrontend_IN_0", "ContosoBackend_IN_1")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesReimageSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesReimageSamples.java new file mode 100644 index 0000000000000..799c066e469ae --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesReimageSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.RoleInstances; +import java.util.Arrays; + +/** Samples for CloudServices Reimage. */ +public final class CloudServicesReimageSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ReimageCloudServiceRoleInstances.json + */ + /** + * Sample code: Reimage Cloud Service Role Instances. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void reimageCloudServiceRoleInstances(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServices() + .reimage( + "ConstosoRG", + "{cs-name}", + new RoleInstances().withRoleInstances(Arrays.asList("ContosoFrontend_IN_0", "ContosoBackend_IN_1")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesRestartSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesRestartSamples.java new file mode 100644 index 0000000000000..f218698348693 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesRestartSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.RoleInstances; +import java.util.Arrays; + +/** Samples for CloudServices Restart. */ +public final class CloudServicesRestartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/RestartCloudServiceRoleInstances.json + */ + /** + * Sample code: Restart Cloud Service Role Instances. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void restartCloudServiceRoleInstances(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServices() + .restart( + "ConstosoRG", + "{cs-name}", + new RoleInstances().withRoleInstances(Arrays.asList("ContosoFrontend_IN_0", "ContosoBackend_IN_1")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesStartSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesStartSamples.java new file mode 100644 index 0000000000000..1ea137384b9bc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesStartSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServices Start. */ +public final class CloudServicesStartSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/StartCloudService.json + */ + /** + * Sample code: Start Cloud Service. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void startCloudService(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServices() + .start("ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesUpdateDomainGetUpdateDomainSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesUpdateDomainGetUpdateDomainSamples.java new file mode 100644 index 0000000000000..c89c69029117a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesUpdateDomainGetUpdateDomainSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServicesUpdateDomain GetUpdateDomain. */ +public final class CloudServicesUpdateDomainGetUpdateDomainSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/GetCloudServiceUpdateDomain.json + */ + /** + * Sample code: Get Cloud Service Update Domain. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getCloudServiceUpdateDomain(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServicesUpdateDomains() + .getUpdateDomainWithResponse("ConstosoRG", "{cs-name}", 1, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesUpdateDomainListUpdateDomainsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesUpdateDomainListUpdateDomainsSamples.java new file mode 100644 index 0000000000000..d0a6ece3df568 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesUpdateDomainListUpdateDomainsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServicesUpdateDomain ListUpdateDomains. */ +public final class CloudServicesUpdateDomainListUpdateDomainsSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/ListCloudServiceUpdateDomains.json + */ + /** + * Sample code: List Update Domains in Cloud Service. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listUpdateDomainsInCloudService(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServicesUpdateDomains() + .listUpdateDomains("ConstosoRG", "{cs-name}", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesUpdateDomainWalkUpdateDomainSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesUpdateDomainWalkUpdateDomainSamples.java new file mode 100644 index 0000000000000..2ebaff1cf434b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesUpdateDomainWalkUpdateDomainSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CloudServicesUpdateDomain WalkUpdateDomain. */ +public final class CloudServicesUpdateDomainWalkUpdateDomainSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/UpdateCloudServiceUpdateDomain.json + */ + /** + * Sample code: Update Cloud Service to specified Domain. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateCloudServiceToSpecifiedDomain(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServicesUpdateDomains() + .walkUpdateDomain("ConstosoRG", "{cs-name}", 1, null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesUpdateSamples.java new file mode 100644 index 0000000000000..8978600a9992f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CloudServicesUpdateSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.CloudServiceUpdate; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CloudServices Update. */ +public final class CloudServicesUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-03-01/examples/UpdateCloudServiceToIncludeTags.json + */ + /** + * Sample code: Update existing Cloud Service to add tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateExistingCloudServiceToAddTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCloudServices() + .update( + "ConstosoRG", + "{cs-name}", + new CloudServiceUpdate().withTags(mapOf("Documentation", "RestAPI")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CommunityGalleriesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CommunityGalleriesGetSamples.java new file mode 100644 index 0000000000000..22e31209c71c0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CommunityGalleriesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CommunityGalleries Get. */ +public final class CommunityGalleriesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/communityGallery/GetACommunityGallery.json + */ + /** + * Sample code: Get a gallery. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAGallery(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCommunityGalleries() + .getWithResponse("myLocation", "publicGalleryName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CommunityGalleryImageVersionsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CommunityGalleryImageVersionsGetSamples.java new file mode 100644 index 0000000000000..d9f5183093cdd --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CommunityGalleryImageVersionsGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CommunityGalleryImageVersions Get. */ +public final class CommunityGalleryImageVersionsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/communityGallery/GetACommunityGalleryImageVersion.json + */ + /** + * Sample code: Get a gallery. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAGallery(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCommunityGalleryImageVersions() + .getWithResponse( + "myLocation", "publicGalleryName", "myGalleryImageName", "myGalleryImageVersionName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CommunityGalleryImagesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CommunityGalleryImagesGetSamples.java new file mode 100644 index 0000000000000..10da1fa920028 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/CommunityGalleryImagesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for CommunityGalleryImages Get. */ +public final class CommunityGalleryImagesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/communityGallery/GetACommunityGalleryImage.json + */ + /** + * Sample code: Get a gallery. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAGallery(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getCommunityGalleryImages() + .getWithResponse("myLocation", "publicGalleryName", "myGalleryImageName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DedicatedHostGroupsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DedicatedHostGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..fe428d942ed89 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DedicatedHostGroupsCreateOrUpdateSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.DedicatedHostGroupInner; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DedicatedHostGroups CreateOrUpdate. */ +public final class DedicatedHostGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateOrUpdateADedicatedHostGroup.json + */ + /** + * Sample code: Create or update a dedicated host group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateADedicatedHostGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDedicatedHostGroups() + .createOrUpdateWithResponse( + "myResourceGroup", + "myDedicatedHostGroup", + new DedicatedHostGroupInner() + .withLocation("westus") + .withTags(mapOf("department", "finance")) + .withZones(Arrays.asList("1")) + .withPlatformFaultDomainCount(3) + .withSupportAutomaticPlacement(true), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DedicatedHostGroupsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DedicatedHostGroupsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..65825dc017757 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DedicatedHostGroupsGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for DedicatedHostGroups GetByResourceGroup. */ +public final class DedicatedHostGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GetADedicatedHostGroup.json + */ + /** + * Sample code: Create a dedicated host group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createADedicatedHostGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDedicatedHostGroups() + .getByResourceGroupWithResponse("myResourceGroup", "myDedicatedHostGroup", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DedicatedHostsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DedicatedHostsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..621d38538828c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DedicatedHostsCreateOrUpdateSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.DedicatedHostInner; +import com.azure.resourcemanager.compute.models.Sku; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DedicatedHosts CreateOrUpdate. */ +public final class DedicatedHostsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateOrUpdateADedicatedHost.json + */ + /** + * Sample code: Create or update a dedicated host . + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateADedicatedHost(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDedicatedHosts() + .createOrUpdate( + "myResourceGroup", + "myDedicatedHostGroup", + "myDedicatedHost", + new DedicatedHostInner() + .withLocation("westus") + .withTags(mapOf("department", "HR")) + .withSku(new Sku().withName("DSv3-Type1")) + .withPlatformFaultDomain(1), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DedicatedHostsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DedicatedHostsGetSamples.java new file mode 100644 index 0000000000000..a6d04f595bd9f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DedicatedHostsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for DedicatedHosts Get. */ +public final class DedicatedHostsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GetADedicatedHost.json + */ + /** + * Sample code: Get a dedicated host. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getADedicatedHost(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDedicatedHosts() + .getWithResponse("myResourceGroup", "myDedicatedHostGroup", "myHost", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..5007c9405f6ab --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesCreateOrUpdateSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.DiskAccessInner; + +/** Samples for DiskAccesses CreateOrUpdate. */ +public final class DiskAccessesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/CreateADiskAccess.json + */ + /** + * Sample code: Create a disk access resource. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createADiskAccessResource(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskAccesses() + .createOrUpdate( + "myResourceGroup", "myDiskAccess", new DiskAccessInner().withLocation("West US"), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesDeleteAPrivateEndpointConnectionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesDeleteAPrivateEndpointConnectionSamples.java new file mode 100644 index 0000000000000..4011cba53bd93 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesDeleteAPrivateEndpointConnectionSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskAccesses DeleteAPrivateEndpointConnection. */ +public final class DiskAccessesDeleteAPrivateEndpointConnectionSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/DeleteAPrivateEndpointConnection.json + */ + /** + * Sample code: Delete a private endpoint connection under a disk access resource. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteAPrivateEndpointConnectionUnderADiskAccessResource( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskAccesses() + .deleteAPrivateEndpointConnection( + "myResourceGroup", "myDiskAccess", "myPrivateEndpointConnection", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesDeleteSamples.java new file mode 100644 index 0000000000000..f8253efae8589 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskAccesses Delete. */ +public final class DiskAccessesDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/DeleteADiskAccess.json + */ + /** + * Sample code: Delete a disk access resource. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteADiskAccessResource(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskAccesses() + .delete("myResourceGroup", "myDiskAccess", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesGetAPrivateEndpointConnectionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesGetAPrivateEndpointConnectionSamples.java new file mode 100644 index 0000000000000..b2c0e35667410 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesGetAPrivateEndpointConnectionSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskAccesses GetAPrivateEndpointConnection. */ +public final class DiskAccessesGetAPrivateEndpointConnectionSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/GetInformationAboutAPrivateEndpointConnection.json + */ + /** + * Sample code: Get information about a private endpoint connection under a disk access resource. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getInformationAboutAPrivateEndpointConnectionUnderADiskAccessResource( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskAccesses() + .getAPrivateEndpointConnectionWithResponse( + "myResourceGroup", "myDiskAccess", "myPrivateEndpointConnection", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..3689e7893bb29 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesGetByResourceGroupSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskAccesses GetByResourceGroup. */ +public final class DiskAccessesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/GetInformationAboutADiskAccess.json + */ + /** + * Sample code: Get information about a disk access resource. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getInformationAboutADiskAccessResource(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskAccesses() + .getByResourceGroupWithResponse("myResourceGroup", "myDiskAccess", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/GetInformationAboutADiskAccessWithPrivateEndpoints.json + */ + /** + * Sample code: Get information about a disk access resource with private endpoints. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getInformationAboutADiskAccessResourceWithPrivateEndpoints( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskAccesses() + .getByResourceGroupWithResponse("myResourceGroup", "myDiskAccess", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesGetPrivateLinkResourcesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesGetPrivateLinkResourcesSamples.java new file mode 100644 index 0000000000000..7dd1da126a033 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesGetPrivateLinkResourcesSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskAccesses GetPrivateLinkResources. */ +public final class DiskAccessesGetPrivateLinkResourcesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/GetDiskAccessPrivateLinkResources.json + */ + /** + * Sample code: List all possible private link resources under disk access resource. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllPossiblePrivateLinkResourcesUnderDiskAccessResource( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskAccesses() + .getPrivateLinkResourcesWithResponse("myResourceGroup", "myDiskAccess", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..a653c321b875e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesListByResourceGroupSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskAccesses ListByResourceGroup. */ +public final class DiskAccessesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/ListDiskAccessesInAResourceGroup.json + */ + /** + * Sample code: List all disk access resources in a resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllDiskAccessResourcesInAResourceGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskAccesses() + .listByResourceGroup("myResourceGroup", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesListPrivateEndpointConnectionsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesListPrivateEndpointConnectionsSamples.java new file mode 100644 index 0000000000000..9fc68a85d1630 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesListPrivateEndpointConnectionsSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskAccesses ListPrivateEndpointConnections. */ +public final class DiskAccessesListPrivateEndpointConnectionsSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/ListPrivateEndpointConnectionsInADiskAccess.json + */ + /** + * Sample code: Get information about a private endpoint connection under a disk access resource. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getInformationAboutAPrivateEndpointConnectionUnderADiskAccessResource( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskAccesses() + .listPrivateEndpointConnections("myResourceGroup", "myDiskAccess", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesListSamples.java new file mode 100644 index 0000000000000..90a4ef6338fc5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskAccesses List. */ +public final class DiskAccessesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/ListDiskAccessesInASubscription.json + */ + /** + * Sample code: List all disk access resources in a subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllDiskAccessResourcesInASubscription(com.azure.resourcemanager.AzureResourceManager azure) { + azure.virtualMachines().manager().serviceClient().getDiskAccesses().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesUpdateAPrivateEndpointConnectionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesUpdateAPrivateEndpointConnectionSamples.java new file mode 100644 index 0000000000000..eb8e0efc7a485 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesUpdateAPrivateEndpointConnectionSamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.compute.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.compute.models.PrivateLinkServiceConnectionState; + +/** Samples for DiskAccesses UpdateAPrivateEndpointConnection. */ +public final class DiskAccessesUpdateAPrivateEndpointConnectionSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/ApprovePrivateEndpointConnection.json + */ + /** + * Sample code: Approve a Private Endpoint Connection under a disk access resource. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void approveAPrivateEndpointConnectionUnderADiskAccessResource( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskAccesses() + .updateAPrivateEndpointConnection( + "myResourceGroup", + "myDiskAccess", + "myPrivateEndpointConnection", + new PrivateEndpointConnectionInner() + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) + .withDescription("Approving myPrivateEndpointConnection")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesUpdateSamples.java new file mode 100644 index 0000000000000..769b983e5e0db --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskAccessesUpdateSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.DiskAccessUpdate; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DiskAccesses Update. */ +public final class DiskAccessesUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/UpdateADiskAccess.json + */ + /** + * Sample code: Update a disk access resource. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateADiskAccessResource(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskAccesses() + .update( + "myResourceGroup", + "myDiskAccess", + new DiskAccessUpdate().withTags(mapOf("department", "Development", "project", "PrivateEndpoints")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskEncryptionSetsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskEncryptionSetsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..ad98164cc0813 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskEncryptionSetsCreateOrUpdateSamples.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.DiskEncryptionSetInner; +import com.azure.resourcemanager.compute.models.DiskEncryptionSetIdentityType; +import com.azure.resourcemanager.compute.models.DiskEncryptionSetType; +import com.azure.resourcemanager.compute.models.EncryptionSetIdentity; +import com.azure.resourcemanager.compute.models.KeyForDiskEncryptionSet; +import com.azure.resourcemanager.compute.models.SourceVault; + +/** Samples for DiskEncryptionSets CreateOrUpdate. */ +public final class DiskEncryptionSetsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/CreateADiskEncryptionSet.json + */ + /** + * Sample code: Create a disk encryption set. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createADiskEncryptionSet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskEncryptionSets() + .createOrUpdate( + "myResourceGroup", + "myDiskEncryptionSet", + new DiskEncryptionSetInner() + .withLocation("West US") + .withIdentity(new EncryptionSetIdentity().withType(DiskEncryptionSetIdentityType.SYSTEM_ASSIGNED)) + .withEncryptionType(DiskEncryptionSetType.ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY) + .withActiveKey( + new KeyForDiskEncryptionSet() + .withSourceVault( + new SourceVault() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault")) + .withKeyUrl("https://myvmvault.vault-int.azure-int.net/keys/{key}")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/CreateADiskEncryptionSetWithKeyVaultFromADifferentSubscription.json + */ + /** + * Sample code: Create a disk encryption set with key vault from a different subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createADiskEncryptionSetWithKeyVaultFromADifferentSubscription( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskEncryptionSets() + .createOrUpdate( + "myResourceGroup", + "myDiskEncryptionSet", + new DiskEncryptionSetInner() + .withLocation("West US") + .withIdentity(new EncryptionSetIdentity().withType(DiskEncryptionSetIdentityType.SYSTEM_ASSIGNED)) + .withEncryptionType(DiskEncryptionSetType.ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY) + .withActiveKey( + new KeyForDiskEncryptionSet() + .withKeyUrl("https://myvaultdifferentsub.vault-int.azure-int.net/keys/{key}")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskEncryptionSetsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskEncryptionSetsDeleteSamples.java new file mode 100644 index 0000000000000..173d2272a0e06 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskEncryptionSetsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskEncryptionSets Delete. */ +public final class DiskEncryptionSetsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/DeleteADiskEncryptionSet.json + */ + /** + * Sample code: Delete a disk encryption set. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteADiskEncryptionSet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskEncryptionSets() + .delete("myResourceGroup", "myDiskEncryptionSet", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskEncryptionSetsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskEncryptionSetsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..2adfcb719ec00 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskEncryptionSetsGetByResourceGroupSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskEncryptionSets GetByResourceGroup. */ +public final class DiskEncryptionSetsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/GetInformationAboutADiskEncryptionSet.json + */ + /** + * Sample code: Get information about a disk encryption set. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getInformationAboutADiskEncryptionSet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskEncryptionSets() + .getByResourceGroupWithResponse("myResourceGroup", "myDiskEncryptionSet", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/GetInformationAboutADiskEncryptionSetWithAutoKeyRotationError.json + */ + /** + * Sample code: Get information about a disk encryption set when auto-key rotation failed. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getInformationAboutADiskEncryptionSetWhenAutoKeyRotationFailed( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskEncryptionSets() + .getByResourceGroupWithResponse("myResourceGroup", "myDiskEncryptionSet", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskEncryptionSetsListAssociatedResourcesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskEncryptionSetsListAssociatedResourcesSamples.java new file mode 100644 index 0000000000000..f12a79b8bd51b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskEncryptionSetsListAssociatedResourcesSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskEncryptionSets ListAssociatedResources. */ +public final class DiskEncryptionSetsListAssociatedResourcesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/ListDiskEncryptionSetAssociatedResources.json + */ + /** + * Sample code: List all resources that are encrypted with this disk encryption set. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllResourcesThatAreEncryptedWithThisDiskEncryptionSet( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskEncryptionSets() + .listAssociatedResources("myResourceGroup", "myDiskEncryptionSet", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskEncryptionSetsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskEncryptionSetsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..701aad2bb143f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskEncryptionSetsListByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskEncryptionSets ListByResourceGroup. */ +public final class DiskEncryptionSetsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/ListDiskEncryptionSetsInAResourceGroup.json + */ + /** + * Sample code: List all disk encryption sets in a resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllDiskEncryptionSetsInAResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskEncryptionSets() + .listByResourceGroup("myResourceGroup", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskEncryptionSetsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskEncryptionSetsListSamples.java new file mode 100644 index 0000000000000..411ea3b231ad7 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskEncryptionSetsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskEncryptionSets List. */ +public final class DiskEncryptionSetsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/ListDiskEncryptionSetsInASubscription.json + */ + /** + * Sample code: List all disk encryption sets in a subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllDiskEncryptionSetsInASubscription(com.azure.resourcemanager.AzureResourceManager azure) { + azure.virtualMachines().manager().serviceClient().getDiskEncryptionSets().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskEncryptionSetsUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskEncryptionSetsUpdateSamples.java new file mode 100644 index 0000000000000..4bffbb91fa7b2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskEncryptionSetsUpdateSamples.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.DiskEncryptionSetIdentityType; +import com.azure.resourcemanager.compute.models.DiskEncryptionSetType; +import com.azure.resourcemanager.compute.models.DiskEncryptionSetUpdate; +import com.azure.resourcemanager.compute.models.EncryptionSetIdentity; +import com.azure.resourcemanager.compute.models.KeyForDiskEncryptionSet; +import com.azure.resourcemanager.compute.models.SourceVault; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DiskEncryptionSets Update. */ +public final class DiskEncryptionSetsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/UpdateADiskEncryptionSetWithRotationToLatestKeyVersionEnabled.json + */ + /** + * Sample code: Update a disk encryption set with rotationToLatestKeyVersionEnabled set to true - Succeeded. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueSucceeded( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskEncryptionSets() + .update( + "myResourceGroup", + "myDiskEncryptionSet", + new DiskEncryptionSetUpdate() + .withIdentity(new EncryptionSetIdentity().withType(DiskEncryptionSetIdentityType.SYSTEM_ASSIGNED)) + .withEncryptionType(DiskEncryptionSetType.ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY) + .withActiveKey( + new KeyForDiskEncryptionSet() + .withKeyUrl("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1")) + .withRotationToLatestKeyVersionEnabled(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/UpdateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledInProgress.json + */ + /** + * Sample code: Update a disk encryption set with rotationToLatestKeyVersionEnabled set to true - Updating. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateADiskEncryptionSetWithRotationToLatestKeyVersionEnabledSetToTrueUpdating( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskEncryptionSets() + .update( + "myResourceGroup", + "myDiskEncryptionSet", + new DiskEncryptionSetUpdate() + .withIdentity(new EncryptionSetIdentity().withType(DiskEncryptionSetIdentityType.SYSTEM_ASSIGNED)) + .withEncryptionType(DiskEncryptionSetType.ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY) + .withActiveKey( + new KeyForDiskEncryptionSet() + .withKeyUrl("https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1")) + .withRotationToLatestKeyVersionEnabled(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/UpdateADiskEncryptionSet.json + */ + /** + * Sample code: Update a disk encryption set. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateADiskEncryptionSet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskEncryptionSets() + .update( + "myResourceGroup", + "myDiskEncryptionSet", + new DiskEncryptionSetUpdate() + .withTags(mapOf("department", "Development", "project", "Encryption")) + .withEncryptionType(DiskEncryptionSetType.ENCRYPTION_AT_REST_WITH_CUSTOMER_KEY) + .withActiveKey( + new KeyForDiskEncryptionSet() + .withSourceVault( + new SourceVault() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault")) + .withKeyUrl("https://myvmvault.vault-int.azure-int.net/keys/keyName/keyVersion")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskRestorePointGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskRestorePointGetSamples.java new file mode 100644 index 0000000000000..baeabc66afe30 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskRestorePointGetSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskRestorePoint Get. */ +public final class DiskRestorePointGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/GetDiskRestorePointResources.json + */ + /** + * Sample code: Get an incremental disk restorePoint resource. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAnIncrementalDiskRestorePointResource(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskRestorePoints() + .getWithResponse( + "myResourceGroup", + "rpc", + "vmrp", + "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskRestorePointGrantAccessSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskRestorePointGrantAccessSamples.java new file mode 100644 index 0000000000000..6f5b3f749c42e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskRestorePointGrantAccessSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.AccessLevel; +import com.azure.resourcemanager.compute.models.GrantAccessData; + +/** Samples for DiskRestorePoint GrantAccess. */ +public final class DiskRestorePointGrantAccessSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/BeginGetAccessDiskRestorePoint.json + */ + /** + * Sample code: Grants access to a diskRestorePoint. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void grantsAccessToADiskRestorePoint(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskRestorePoints() + .grantAccess( + "myResourceGroup", + "rpc", + "vmrp", + "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + new GrantAccessData().withAccess(AccessLevel.READ).withDurationInSeconds(300), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskRestorePointListByRestorePointSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskRestorePointListByRestorePointSamples.java new file mode 100644 index 0000000000000..4276d9c75f6d2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskRestorePointListByRestorePointSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskRestorePoint ListByRestorePoint. */ +public final class DiskRestorePointListByRestorePointSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/ListDiskRestorePointsInVmRestorePoint.json + */ + /** + * Sample code: Get an incremental disk restorePoint resource. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAnIncrementalDiskRestorePointResource(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskRestorePoints() + .listByRestorePoint("myResourceGroup", "rpc", "vmrp", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskRestorePointRevokeAccessSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskRestorePointRevokeAccessSamples.java new file mode 100644 index 0000000000000..036f9ae659007 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DiskRestorePointRevokeAccessSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for DiskRestorePoint RevokeAccess. */ +public final class DiskRestorePointRevokeAccessSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/EndGetAccessDiskRestorePoint.json + */ + /** + * Sample code: Revokes access to a diskRestorePoint. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void revokesAccessToADiskRestorePoint(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDiskRestorePoints() + .revokeAccess( + "myResourceGroup", + "rpc", + "vmrp", + "TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e6fcc2ec012ff --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksCreateOrUpdateSamples.java @@ -0,0 +1,379 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.DiskInner; +import com.azure.resourcemanager.compute.models.CreationData; +import com.azure.resourcemanager.compute.models.DiskCreateOption; +import com.azure.resourcemanager.compute.models.DiskSecurityProfile; +import com.azure.resourcemanager.compute.models.DiskSecurityTypes; +import com.azure.resourcemanager.compute.models.DiskSku; +import com.azure.resourcemanager.compute.models.DiskStorageAccountTypes; +import com.azure.resourcemanager.compute.models.Encryption; +import com.azure.resourcemanager.compute.models.ExtendedLocation; +import com.azure.resourcemanager.compute.models.ExtendedLocationTypes; +import com.azure.resourcemanager.compute.models.ImageDiskReference; +import com.azure.resourcemanager.compute.models.NetworkAccessPolicy; +import com.azure.resourcemanager.compute.models.OperatingSystemTypes; + +/** Samples for Disks CreateOrUpdate. */ +public final class DisksCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/CreateAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription.json + */ + /** + * Sample code: Create a managed disk by importing an unmanaged blob from a different subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAManagedDiskByImportingAnUnmanagedBlobFromADifferentSubscription( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .createOrUpdate( + "myResourceGroup", + "myDisk", + new DiskInner() + .withLocation("West US") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.IMPORT) + .withStorageAccountId( + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount") + .withSourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/CreateAManagedDiskWithDiskAccess.json + */ + /** + * Sample code: Create a managed disk and associate with disk access resource. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAManagedDiskAndAssociateWithDiskAccessResource( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .createOrUpdate( + "myResourceGroup", + "myDisk", + new DiskInner() + .withLocation("West US") + .withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)) + .withDiskSizeGB(200) + .withNetworkAccessPolicy(NetworkAccessPolicy.ALLOW_PRIVATE) + .withDiskAccessId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/{existing-diskAccess-name}"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/CreateAManagedDiskWithDiskEncryptionSet.json + */ + /** + * Sample code: Create a managed disk and associate with disk encryption set. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAManagedDiskAndAssociateWithDiskEncryptionSet( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .createOrUpdate( + "myResourceGroup", + "myDisk", + new DiskInner() + .withLocation("West US") + .withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)) + .withDiskSizeGB(200) + .withEncryption( + new Encryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/CreateAManagedDiskFromAnExistingManagedDisk.json + */ + /** + * Sample code: Create a managed disk from an existing managed disk in the same or different subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAManagedDiskFromAnExistingManagedDiskInTheSameOrDifferentSubscription( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .createOrUpdate( + "myResourceGroup", + "myDisk2", + new DiskInner() + .withLocation("West US") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.COPY) + .withSourceResourceId( + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/CreateAManagedDiskWithSecurityProfile.json + */ + /** + * Sample code: Create a managed disk with security profile. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAManagedDiskWithSecurityProfile(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .createOrUpdate( + "myResourceGroup", + "myDisk", + new DiskInner() + .withLocation("North Central US") + .withOsType(OperatingSystemTypes.WINDOWS) + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.FROM_IMAGE) + .withImageReference( + new ImageDiskReference() + .withId( + "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}"))) + .withSecurityProfile(new DiskSecurityProfile().withSecurityType(DiskSecurityTypes.TRUSTED_LAUNCH)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/CreateAManagedDiskWithLogicalSectorSize.json + */ + /** + * Sample code: Create an ultra managed disk with logicalSectorSize 512E. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAnUltraManagedDiskWithLogicalSectorSize512E( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .createOrUpdate( + "myResourceGroup", + "myDisk", + new DiskInner() + .withLocation("West US") + .withSku(new DiskSku().withName(DiskStorageAccountTypes.ULTRA_SSD_LRS)) + .withCreationData( + new CreationData().withCreateOption(DiskCreateOption.EMPTY).withLogicalSectorSize(512)) + .withDiskSizeGB(200), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/CreateAManagedDiskFromAPlatformImage.json + */ + /** + * Sample code: Create a managed disk from a platform image. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAManagedDiskFromAPlatformImage(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .createOrUpdate( + "myResourceGroup", + "myDisk", + new DiskInner() + .withLocation("West US") + .withOsType(OperatingSystemTypes.WINDOWS) + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.FROM_IMAGE) + .withImageReference( + new ImageDiskReference() + .withId( + "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/CreateAnEmptyManagedDisk.json + */ + /** + * Sample code: Create an empty managed disk. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAnEmptyManagedDisk(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .createOrUpdate( + "myResourceGroup", + "myDisk", + new DiskInner() + .withLocation("West US") + .withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)) + .withDiskSizeGB(200), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/CreateAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription.json + */ + /** + * Sample code: Create a managed disk by importing an unmanaged blob from the same subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAManagedDiskByImportingAnUnmanagedBlobFromTheSameSubscription( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .createOrUpdate( + "myResourceGroup", + "myDisk", + new DiskInner() + .withLocation("West US") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.IMPORT) + .withSourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/CreateAManagedDiskByCopyingASnapshot.json + */ + /** + * Sample code: Create a managed disk by copying a snapshot. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAManagedDiskByCopyingASnapshot(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .createOrUpdate( + "myResourceGroup", + "myDisk", + new DiskInner() + .withLocation("West US") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.COPY) + .withSourceResourceId( + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/CreateAManagedDiskWithSSDZRSAccountType.json + */ + /** + * Sample code: Create a managed disk with ssd zrs account type. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAManagedDiskWithSsdZrsAccountType(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .createOrUpdate( + "myResourceGroup", + "myDisk", + new DiskInner() + .withLocation("West US") + .withSku(new DiskSku().withName(DiskStorageAccountTypes.PREMIUM_ZRS)) + .withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)) + .withDiskSizeGB(200), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/CreateAnEmptyManagedDiskInExtendedLocation.json + */ + /** + * Sample code: Create an empty managed disk in extended location. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAnEmptyManagedDiskInExtendedLocation( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .createOrUpdate( + "myResourceGroup", + "myDisk", + new DiskInner() + .withLocation("West US") + .withExtendedLocation( + new ExtendedLocation().withName("{edge-zone-id}").withType(ExtendedLocationTypes.EDGE_ZONE)) + .withCreationData(new CreationData().withCreateOption(DiskCreateOption.EMPTY)) + .withDiskSizeGB(200), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/CreateAManagedUploadDisk.json + */ + /** + * Sample code: Create a managed upload disk. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAManagedUploadDisk(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .createOrUpdate( + "myResourceGroup", + "myDisk", + new DiskInner() + .withLocation("West US") + .withCreationData( + new CreationData().withCreateOption(DiskCreateOption.UPLOAD).withUploadSizeBytes(10737418752L)), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksDeleteSamples.java new file mode 100644 index 0000000000000..a596219ea0865 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for Disks Delete. */ +public final class DisksDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/DeleteAManagedDisk.json + */ + /** + * Sample code: Delete a managed disk. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteAManagedDisk(com.azure.resourcemanager.AzureResourceManager azure) { + azure.virtualMachines().manager().serviceClient().getDisks().delete("myResourceGroup", "myDisk", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..ce3f8bb25e04f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for Disks GetByResourceGroup. */ +public final class DisksGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/GetInformationAboutAManagedDisk.json + */ + /** + * Sample code: Get information about a managed disk. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getInformationAboutAManagedDisk(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .getByResourceGroupWithResponse("myResourceGroup", "myManagedDisk", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksGrantAccessSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksGrantAccessSamples.java new file mode 100644 index 0000000000000..a9b6908ce45a9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksGrantAccessSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.AccessLevel; +import com.azure.resourcemanager.compute.models.GrantAccessData; + +/** Samples for Disks GrantAccess. */ +public final class DisksGrantAccessSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/BeginGetAccessManagedDisk.json + */ + /** + * Sample code: Get a sas on a managed disk. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getASasOnAManagedDisk(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .grantAccess( + "myResourceGroup", + "myDisk", + new GrantAccessData().withAccess(AccessLevel.READ).withDurationInSeconds(300), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksListByResourceGroupSamples.java new file mode 100644 index 0000000000000..f8e94063c7ddd --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksListByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for Disks ListByResourceGroup. */ +public final class DisksListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/ListManagedDisksInAResourceGroup.json + */ + /** + * Sample code: List all managed disks in a resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllManagedDisksInAResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .listByResourceGroup("myResourceGroup", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksListSamples.java new file mode 100644 index 0000000000000..81d16c49d2a8c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for Disks List. */ +public final class DisksListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/ListManagedDisksInASubscription.json + */ + /** + * Sample code: List all managed disks in a subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllManagedDisksInASubscription(com.azure.resourcemanager.AzureResourceManager azure) { + azure.virtualMachines().manager().serviceClient().getDisks().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksRevokeAccessSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksRevokeAccessSamples.java new file mode 100644 index 0000000000000..d7f728d48ea26 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksRevokeAccessSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for Disks RevokeAccess. */ +public final class DisksRevokeAccessSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/EndGetAccessManagedDisk.json + */ + /** + * Sample code: Revoke access to a managed disk. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void revokeAccessToAManagedDisk(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .revokeAccess("myResourceGroup", "myDisk", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksUpdateSamples.java new file mode 100644 index 0000000000000..ec3711b0e681c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/DisksUpdateSamples.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.DiskUpdate; +import com.azure.resourcemanager.compute.models.NetworkAccessPolicy; +import com.azure.resourcemanager.compute.models.PurchasePlanAutoGenerated; +import com.azure.resourcemanager.compute.models.SupportedCapabilities; + +/** Samples for Disks Update. */ +public final class DisksUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/UpdateAManagedDiskToDisableBursting.json + */ + /** + * Sample code: Update a managed disk to disable bursting. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateAManagedDiskToDisableBursting(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .update("myResourceGroup", "myDisk", new DiskUpdate().withBurstingEnabled(false), Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/UpdateAManagedDiskToAddPurchasePlan.json + */ + /** + * Sample code: Update a managed disk to add purchase plan. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateAManagedDiskToAddPurchasePlan(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .update( + "myResourceGroup", + "myDisk", + new DiskUpdate() + .withPurchasePlan( + new PurchasePlanAutoGenerated() + .withName("myPurchasePlanName") + .withPublisher("myPurchasePlanPublisher") + .withProduct("myPurchasePlanProduct") + .withPromotionCode("myPurchasePlanPromotionCode")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/UpdateAManagedDiskToChangeTier.json + */ + /** + * Sample code: Update a managed disk to change tier. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateAManagedDiskToChangeTier(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .update("myResourceGroup", "myDisk", new DiskUpdate().withTier("P30"), Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/CreateOrUpdateABurstingEnabledManagedDisk.json + */ + /** + * Sample code: Create or update a bursting enabled managed disk. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateABurstingEnabledManagedDisk(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .update( + "myResourceGroup", + "myDisk", + new DiskUpdate().withDiskSizeGB(1024).withBurstingEnabled(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/UpdateAManagedDiskToAddSupportsHibernation.json + */ + /** + * Sample code: Update a managed disk to add supportsHibernation. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateAManagedDiskToAddSupportsHibernation( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .update("myResourceGroup", "myDisk", new DiskUpdate().withSupportsHibernation(true), Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/UpdateAManagedDiskToRemoveDiskAccess.json + */ + /** + * Sample code: Update managed disk to remove disk access resource association. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateManagedDiskToRemoveDiskAccessResourceAssociation( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .update( + "myResourceGroup", + "myDisk", + new DiskUpdate().withNetworkAccessPolicy(NetworkAccessPolicy.ALLOW_ALL), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/UpdateAManagedDiskToAddAcceleratedNetworking.json + */ + /** + * Sample code: Update a managed disk to add accelerated networking. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateAManagedDiskToAddAcceleratedNetworking( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getDisks() + .update( + "myResourceGroup", + "myDisk", + new DiskUpdate().withSupportedCapabilities(new SupportedCapabilities().withAcceleratedNetwork(false)), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleriesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleriesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..3e9eed3426832 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleriesCreateOrUpdateSamples.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.GalleryInner; +import com.azure.resourcemanager.compute.models.GallerySharingPermissionTypes; +import com.azure.resourcemanager.compute.models.SharingProfile; +import com.azure.resourcemanager.compute.models.SoftDeletePolicy; + +/** Samples for Galleries CreateOrUpdate. */ +public final class GalleriesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryWithSharingProfile.json + */ + /** + * Sample code: Create or update a simple gallery with sharing profile. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateASimpleGalleryWithSharingProfile( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleries() + .createOrUpdate( + "myResourceGroup", + "myGalleryName", + new GalleryInner() + .withLocation("West US") + .withDescription("This is the gallery description.") + .withSharingProfile(new SharingProfile().withPermissions(GallerySharingPermissionTypes.GROUPS)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGallery.json + */ + /** + * Sample code: Create or update a simple gallery. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateASimpleGallery(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleries() + .createOrUpdate( + "myResourceGroup", + "myGalleryName", + new GalleryInner().withLocation("West US").withDescription("This is the gallery description."), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryWithSoftDeletionEnabled.json + */ + /** + * Sample code: Create or update a simple gallery with soft deletion enabled. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateASimpleGalleryWithSoftDeletionEnabled( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleries() + .createOrUpdate( + "myResourceGroup", + "myGalleryName", + new GalleryInner() + .withLocation("West US") + .withDescription("This is the gallery description.") + .withSoftDeletePolicy(new SoftDeletePolicy().withIsSoftDeleteEnabled(true)), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleriesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleriesDeleteSamples.java new file mode 100644 index 0000000000000..93bcd3cc1b09f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleriesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for Galleries Delete. */ +public final class GalleriesDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/DeleteAGallery.json + */ + /** + * Sample code: Delete a gallery. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteAGallery(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleries() + .delete("myResourceGroup", "myGalleryName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleriesGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleriesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..1eb1a5ebc6787 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleriesGetByResourceGroupSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.SelectPermissions; + +/** Samples for Galleries GetByResourceGroup. */ +public final class GalleriesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryWithSelectPermissions.json + */ + /** + * Sample code: Get a gallery with select permissions. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAGalleryWithSelectPermissions(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleries() + .getByResourceGroupWithResponse( + "myResourceGroup", "myGalleryName", SelectPermissions.PERMISSIONS, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGallery.json + */ + /** + * Sample code: Get a gallery. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAGallery(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleries() + .getByResourceGroupWithResponse("myResourceGroup", "myGalleryName", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleriesListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleriesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..94bdb0c02bb17 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleriesListByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for Galleries ListByResourceGroup. */ +public final class GalleriesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/ListGalleriesInAResourceGroup.json + */ + /** + * Sample code: List galleries in a resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listGalleriesInAResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleries() + .listByResourceGroup("myResourceGroup", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleriesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleriesListSamples.java new file mode 100644 index 0000000000000..49f25cc9b562c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleriesListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for Galleries List. */ +public final class GalleriesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/ListGalleriesInASubscription.json + */ + /** + * Sample code: List galleries in a subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listGalleriesInASubscription(com.azure.resourcemanager.AzureResourceManager azure) { + azure.virtualMachines().manager().serviceClient().getGalleries().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleriesUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleriesUpdateSamples.java new file mode 100644 index 0000000000000..bf3acc9e666dc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleriesUpdateSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.GalleryUpdate; + +/** Samples for Galleries Update. */ +public final class GalleriesUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/UpdateASimpleGallery.json + */ + /** + * Sample code: Update a simple gallery. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateASimpleGallery(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleries() + .update( + "myResourceGroup", + "myGalleryName", + new GalleryUpdate().withDescription("This is the gallery description."), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationVersionsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationVersionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..9ff81ad98ed17 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationVersionsCreateOrUpdateSamples.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.GalleryApplicationVersionInner; +import com.azure.resourcemanager.compute.models.GalleryApplicationVersionPublishingProfile; +import com.azure.resourcemanager.compute.models.StorageAccountType; +import com.azure.resourcemanager.compute.models.TargetRegion; +import com.azure.resourcemanager.compute.models.UserArtifactManage; +import com.azure.resourcemanager.compute.models.UserArtifactSource; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for GalleryApplicationVersions CreateOrUpdate. */ +public final class GalleryApplicationVersionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryApplicationVersion.json + */ + /** + * Sample code: Create or update a simple gallery Application Version. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateASimpleGalleryApplicationVersion( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryApplicationVersions() + .createOrUpdate( + "myResourceGroup", + "myGalleryName", + "myGalleryApplicationName", + "1.0.0", + new GalleryApplicationVersionInner() + .withLocation("West US") + .withPublishingProfile( + new GalleryApplicationVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withStorageAccountType(StorageAccountType.STANDARD_LRS))) + .withReplicaCount(1) + .withEndOfLifeDate(OffsetDateTime.parse("2019-07-01T07:00:00Z")) + .withStorageAccountType(StorageAccountType.STANDARD_LRS) + .withSource( + new UserArtifactSource() + .withMediaLink( + "https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}")) + .withManageActions( + new UserArtifactManage() + .withInstall( + "powershell -command \"Expand-Archive -Path package.zip -DestinationPath" + + " C:\\package\"") + .withRemove("del C:\\package "))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationVersionsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationVersionsDeleteSamples.java new file mode 100644 index 0000000000000..8e35e8f791063 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationVersionsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for GalleryApplicationVersions Delete. */ +public final class GalleryApplicationVersionsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/DeleteAGalleryApplicationVersion.json + */ + /** + * Sample code: Delete a gallery Application Version. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteAGalleryApplicationVersion(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryApplicationVersions() + .delete("myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationVersionsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationVersionsGetSamples.java new file mode 100644 index 0000000000000..773fc6a496c95 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationVersionsGetSamples.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.ReplicationStatusTypes; + +/** Samples for GalleryApplicationVersions Get. */ +public final class GalleryApplicationVersionsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryApplicationVersion.json + */ + /** + * Sample code: Get a gallery Application Version. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAGalleryApplicationVersion(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryApplicationVersions() + .getWithResponse( + "myResourceGroup", "myGalleryName", "myGalleryApplicationName", "1.0.0", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryApplicationVersionWithReplicationStatus.json + */ + /** + * Sample code: Get a gallery Application Version with replication status. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAGalleryApplicationVersionWithReplicationStatus( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryApplicationVersions() + .getWithResponse( + "myResourceGroup", + "myGalleryName", + "myGalleryApplicationName", + "1.0.0", + ReplicationStatusTypes.REPLICATION_STATUS, + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationVersionsListByGalleryApplicationSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationVersionsListByGalleryApplicationSamples.java new file mode 100644 index 0000000000000..f93cc4ccec39f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationVersionsListByGalleryApplicationSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for GalleryApplicationVersions ListByGalleryApplication. */ +public final class GalleryApplicationVersionsListByGalleryApplicationSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/ListGalleryApplicationVersionsInAGalleryApplication.json + */ + /** + * Sample code: List gallery Application Versions in a gallery Application Definition. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listGalleryApplicationVersionsInAGalleryApplicationDefinition( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryApplicationVersions() + .listByGalleryApplication("myResourceGroup", "myGalleryName", "myGalleryApplicationName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationVersionsUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationVersionsUpdateSamples.java new file mode 100644 index 0000000000000..bd56f1c1b5848 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationVersionsUpdateSamples.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.GalleryApplicationVersionPublishingProfile; +import com.azure.resourcemanager.compute.models.GalleryApplicationVersionUpdate; +import com.azure.resourcemanager.compute.models.StorageAccountType; +import com.azure.resourcemanager.compute.models.TargetRegion; +import com.azure.resourcemanager.compute.models.UserArtifactManage; +import com.azure.resourcemanager.compute.models.UserArtifactSource; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for GalleryApplicationVersions Update. */ +public final class GalleryApplicationVersionsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/UpdateASimpleGalleryApplicationVersion.json + */ + /** + * Sample code: Update a simple gallery Application Version. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateASimpleGalleryApplicationVersion(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryApplicationVersions() + .update( + "myResourceGroup", + "myGalleryName", + "myGalleryApplicationName", + "1.0.0", + new GalleryApplicationVersionUpdate() + .withPublishingProfile( + new GalleryApplicationVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withStorageAccountType(StorageAccountType.STANDARD_LRS))) + .withReplicaCount(1) + .withEndOfLifeDate(OffsetDateTime.parse("2019-07-01T07:00:00Z")) + .withStorageAccountType(StorageAccountType.STANDARD_LRS) + .withSource( + new UserArtifactSource() + .withMediaLink( + "https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}")) + .withManageActions( + new UserArtifactManage() + .withInstall( + "powershell -command \"Expand-Archive -Path package.zip -DestinationPath" + + " C:\\package\"") + .withRemove("del C:\\package "))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..18152503a02a6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationsCreateOrUpdateSamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.GalleryApplicationInner; +import com.azure.resourcemanager.compute.models.OperatingSystemTypes; + +/** Samples for GalleryApplications CreateOrUpdate. */ +public final class GalleryApplicationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryApplication.json + */ + /** + * Sample code: Create or update a simple gallery Application. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateASimpleGalleryApplication(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryApplications() + .createOrUpdate( + "myResourceGroup", + "myGalleryName", + "myGalleryApplicationName", + new GalleryApplicationInner() + .withLocation("West US") + .withDescription("This is the gallery application description.") + .withEula("This is the gallery application EULA.") + .withPrivacyStatementUri("myPrivacyStatementUri}") + .withReleaseNoteUri("myReleaseNoteUri") + .withSupportedOSType(OperatingSystemTypes.WINDOWS), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationsDeleteSamples.java new file mode 100644 index 0000000000000..e0a954f487cfc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for GalleryApplications Delete. */ +public final class GalleryApplicationsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/DeleteAGalleryApplication.json + */ + /** + * Sample code: Delete a gallery Application. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteAGalleryApplication(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryApplications() + .delete("myResourceGroup", "myGalleryName", "myGalleryApplicationName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationsGetSamples.java new file mode 100644 index 0000000000000..19a0811fe09f9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for GalleryApplications Get. */ +public final class GalleryApplicationsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryApplication.json + */ + /** + * Sample code: Get a gallery Application. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAGalleryApplication(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryApplications() + .getWithResponse("myResourceGroup", "myGalleryName", "myGalleryApplicationName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationsListByGallerySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationsListByGallerySamples.java new file mode 100644 index 0000000000000..a81daf3863f8e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationsListByGallerySamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for GalleryApplications ListByGallery. */ +public final class GalleryApplicationsListByGallerySamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/ListGalleryApplicationsInAGallery.json + */ + /** + * Sample code: List gallery Applications in a gallery. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listGalleryApplicationsInAGallery(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryApplications() + .listByGallery("myResourceGroup", "myGalleryName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationsUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationsUpdateSamples.java new file mode 100644 index 0000000000000..e128d7aa02199 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryApplicationsUpdateSamples.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.GalleryApplicationUpdate; +import com.azure.resourcemanager.compute.models.OperatingSystemTypes; + +/** Samples for GalleryApplications Update. */ +public final class GalleryApplicationsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/UpdateASimpleGalleryApplication.json + */ + /** + * Sample code: Update a simple gallery Application. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateASimpleGalleryApplication(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryApplications() + .update( + "myResourceGroup", + "myGalleryName", + "myGalleryApplicationName", + new GalleryApplicationUpdate() + .withDescription("This is the gallery application description.") + .withEula("This is the gallery application EULA.") + .withPrivacyStatementUri("myPrivacyStatementUri}") + .withReleaseNoteUri("myReleaseNoteUri") + .withSupportedOSType(OperatingSystemTypes.WINDOWS), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImageVersionsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImageVersionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..41be15123dcf0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImageVersionsCreateOrUpdateSamples.java @@ -0,0 +1,528 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.GalleryImageVersionInner; +import com.azure.resourcemanager.compute.models.DataDiskImageEncryption; +import com.azure.resourcemanager.compute.models.EncryptionImages; +import com.azure.resourcemanager.compute.models.GalleryArtifactVersionSource; +import com.azure.resourcemanager.compute.models.GalleryDataDiskImage; +import com.azure.resourcemanager.compute.models.GalleryImageVersionPublishingProfile; +import com.azure.resourcemanager.compute.models.GalleryImageVersionStorageProfile; +import com.azure.resourcemanager.compute.models.GalleryOSDiskImage; +import com.azure.resourcemanager.compute.models.HostCaching; +import com.azure.resourcemanager.compute.models.OSDiskImageEncryption; +import com.azure.resourcemanager.compute.models.ReplicationMode; +import com.azure.resourcemanager.compute.models.StorageAccountType; +import com.azure.resourcemanager.compute.models.TargetRegion; +import java.util.Arrays; + +/** Samples for GalleryImageVersions CreateOrUpdate. */ +public final class GalleryImageVersionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImageVersionWithShallowReplicationMode.json + */ + /** + * Sample code: Create or update a simple Gallery Image Version using shallow replication mode. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateASimpleGalleryImageVersionUsingShallowReplicationMode( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryImageVersions() + .createOrUpdate( + "myResourceGroup", + "myGalleryName", + "myGalleryImageName", + "1.0.0", + new GalleryImageVersionInner() + .withLocation("West US") + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays.asList(new TargetRegion().withName("West US").withRegionalReplicaCount(1))) + .withReplicationMode(ReplicationMode.SHALLOW)) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImageVersionWithVHD.json + */ + /** + * Sample code: Create or update a simple Gallery Image Version using vhd as a source. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateASimpleGalleryImageVersionUsingVhdAsASource( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryImageVersions() + .createOrUpdate( + "myResourceGroup", + "myGalleryName", + "myGalleryImageName", + "1.0.0", + new GalleryImageVersionInner() + .withLocation("West US") + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet") + .withLun(1)))), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS)))) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withOsDiskImage( + new GalleryOSDiskImage() + .withHostCaching(HostCaching.READ_ONLY) + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}") + .withUri( + "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd"))) + .withDataDiskImages( + Arrays + .asList( + new GalleryDataDiskImage() + .withHostCaching(HostCaching.NONE) + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}") + .withUri( + "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd")) + .withLun(1)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImageVersionWithVMAsSource.json + */ + /** + * Sample code: Create or update a simple Gallery Image Version using VM as source. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateASimpleGalleryImageVersionUsingVMAsSource( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryImageVersions() + .createOrUpdate( + "myResourceGroup", + "myGalleryName", + "myGalleryImageName", + "1.0.0", + new GalleryImageVersionInner() + .withLocation("West US") + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet") + .withLun(0), + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet") + .withLun(1)))), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet") + .withLun(0), + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet") + .withLun(1))))))) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImageVersionWithImageVersionAsSource.json + */ + /** + * Sample code: Create or update a simple Gallery Image Version using shared image as source. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateASimpleGalleryImageVersionUsingSharedImageAsSource( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryImageVersions() + .createOrUpdate( + "myResourceGroup", + "myGalleryName", + "myGalleryImageName", + "1.0.0", + new GalleryImageVersionInner() + .withLocation("West US") + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet") + .withLun(0), + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet") + .withLun(1)))), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet") + .withLun(0), + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet") + .withLun(1))))))) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImageVersionWithSnapshotsAsSource.json + */ + /** + * Sample code: Create or update a simple Gallery Image Version using mix of disks and snapshots as a source. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateASimpleGalleryImageVersionUsingMixOfDisksAndSnapshotsAsASource( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryImageVersions() + .createOrUpdate( + "myResourceGroup", + "myGalleryName", + "myGalleryImageName", + "1.0.0", + new GalleryImageVersionInner() + .withLocation("West US") + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet") + .withLun(1)))), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet") + .withLun(1))))))) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withOsDiskImage( + new GalleryOSDiskImage() + .withHostCaching(HostCaching.READ_ONLY) + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"))) + .withDataDiskImages( + Arrays + .asList( + new GalleryDataDiskImage() + .withHostCaching(HostCaching.NONE) + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}")) + .withLun(1)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImageVersionWithSnapshotsAsSource.json + */ + /** + * Sample code: Create or update a simple Gallery Image Version using snapshots as a source. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateASimpleGalleryImageVersionUsingSnapshotsAsASource( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryImageVersions() + .createOrUpdate( + "myResourceGroup", + "myGalleryName", + "myGalleryImageName", + "1.0.0", + new GalleryImageVersionInner() + .withLocation("West US") + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet") + .withLun(1)))), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet") + .withLun(1))))))) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withOsDiskImage( + new GalleryOSDiskImage() + .withHostCaching(HostCaching.READ_ONLY) + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}"))) + .withDataDiskImages( + Arrays + .asList( + new GalleryDataDiskImage() + .withHostCaching(HostCaching.NONE) + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}")) + .withLun(1)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImageVersion.json + */ + /** + * Sample code: Create or update a simple Gallery Image Version using managed image as source. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateASimpleGalleryImageVersionUsingManagedImageAsSource( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryImageVersions() + .createOrUpdate( + "myResourceGroup", + "myGalleryName", + "myGalleryImageName", + "1.0.0", + new GalleryImageVersionInner() + .withLocation("West US") + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion() + .withName("West US") + .withRegionalReplicaCount(1) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet") + .withLun(0), + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet") + .withLun(1)))), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS) + .withEncryption( + new EncryptionImages() + .withOsDiskImage( + new OSDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet")) + .withDataDiskImages( + Arrays + .asList( + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet") + .withLun(0), + new DataDiskImageEncryption() + .withDiskEncryptionSetId( + "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet") + .withLun(1))))))) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImageVersionsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImageVersionsDeleteSamples.java new file mode 100644 index 0000000000000..8571a8aaf638f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImageVersionsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for GalleryImageVersions Delete. */ +public final class GalleryImageVersionsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/DeleteAGalleryImageVersion.json + */ + /** + * Sample code: Delete a gallery image version. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteAGalleryImageVersion(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryImageVersions() + .delete("myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImageVersionsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImageVersionsGetSamples.java new file mode 100644 index 0000000000000..7139f69d1020e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImageVersionsGetSamples.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.ReplicationStatusTypes; + +/** Samples for GalleryImageVersions Get. */ +public final class GalleryImageVersionsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryImageVersionWithVhdAsSource.json + */ + /** + * Sample code: Get a gallery image version with vhd as a source. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAGalleryImageVersionWithVhdAsASource(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryImageVersions() + .getWithResponse("myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryImageVersion.json + */ + /** + * Sample code: Get a gallery image version. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAGalleryImageVersion(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryImageVersions() + .getWithResponse("myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryImageVersionWithReplicationStatus.json + */ + /** + * Sample code: Get a gallery image version with replication status. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAGalleryImageVersionWithReplicationStatus( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryImageVersions() + .getWithResponse( + "myResourceGroup", + "myGalleryName", + "myGalleryImageName", + "1.0.0", + ReplicationStatusTypes.REPLICATION_STATUS, + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryImageVersionWithSnapshotsAsSource.json + */ + /** + * Sample code: Get a gallery image version with snapshots as a source. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAGalleryImageVersionWithSnapshotsAsASource( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryImageVersions() + .getWithResponse("myResourceGroup", "myGalleryName", "myGalleryImageName", "1.0.0", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImageVersionsListByGalleryImageSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImageVersionsListByGalleryImageSamples.java new file mode 100644 index 0000000000000..a889b26cbeb11 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImageVersionsListByGalleryImageSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for GalleryImageVersions ListByGalleryImage. */ +public final class GalleryImageVersionsListByGalleryImageSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/ListGalleryImageVersionsInAGalleryImage.json + */ + /** + * Sample code: List gallery image versions in a gallery image definition. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listGalleryImageVersionsInAGalleryImageDefinition( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryImageVersions() + .listByGalleryImage("myResourceGroup", "myGalleryName", "myGalleryImageName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImageVersionsUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImageVersionsUpdateSamples.java new file mode 100644 index 0000000000000..a5b577c6d6202 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImageVersionsUpdateSamples.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.GalleryArtifactVersionSource; +import com.azure.resourcemanager.compute.models.GalleryImageVersionPublishingProfile; +import com.azure.resourcemanager.compute.models.GalleryImageVersionStorageProfile; +import com.azure.resourcemanager.compute.models.GalleryImageVersionUpdate; +import com.azure.resourcemanager.compute.models.StorageAccountType; +import com.azure.resourcemanager.compute.models.TargetRegion; +import java.util.Arrays; + +/** Samples for GalleryImageVersions Update. */ +public final class GalleryImageVersionsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/UpdateASimpleGalleryImageVersion.json + */ + /** + * Sample code: Update a simple Gallery Image Version (Managed Image as source). + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateASimpleGalleryImageVersionManagedImageAsSource( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryImageVersions() + .update( + "myResourceGroup", + "myGalleryName", + "myGalleryImageName", + "1.0.0", + new GalleryImageVersionUpdate() + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion().withName("West US").withRegionalReplicaCount(1), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS)))) + .withStorageProfile( + new GalleryImageVersionStorageProfile() + .withSource( + new GalleryArtifactVersionSource() + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/UpdateASimpleGalleryImageVersionWithoutSourceId.json + */ + /** + * Sample code: Update a simple Gallery Image Version without source id. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateASimpleGalleryImageVersionWithoutSourceId( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryImageVersions() + .update( + "myResourceGroup", + "myGalleryName", + "myGalleryImageName", + "1.0.0", + new GalleryImageVersionUpdate() + .withPublishingProfile( + new GalleryImageVersionPublishingProfile() + .withTargetRegions( + Arrays + .asList( + new TargetRegion().withName("West US").withRegionalReplicaCount(1), + new TargetRegion() + .withName("East US") + .withRegionalReplicaCount(2) + .withStorageAccountType(StorageAccountType.STANDARD_ZRS)))) + .withStorageProfile(new GalleryImageVersionStorageProfile()), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImagesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImagesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..9b41c078a0750 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImagesCreateOrUpdateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.GalleryImageInner; +import com.azure.resourcemanager.compute.models.GalleryImageIdentifier; +import com.azure.resourcemanager.compute.models.HyperVGeneration; +import com.azure.resourcemanager.compute.models.OperatingSystemStateTypes; +import com.azure.resourcemanager.compute.models.OperatingSystemTypes; + +/** Samples for GalleryImages CreateOrUpdate. */ +public final class GalleryImagesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/CreateOrUpdateASimpleGalleryImage.json + */ + /** + * Sample code: Create or update a simple gallery image. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateASimpleGalleryImage(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryImages() + .createOrUpdate( + "myResourceGroup", + "myGalleryName", + "myGalleryImageName", + new GalleryImageInner() + .withLocation("West US") + .withOsType(OperatingSystemTypes.WINDOWS) + .withOsState(OperatingSystemStateTypes.GENERALIZED) + .withHyperVGeneration(HyperVGeneration.V1) + .withIdentifier( + new GalleryImageIdentifier() + .withPublisher("myPublisherName") + .withOffer("myOfferName") + .withSku("mySkuName")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImagesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImagesDeleteSamples.java new file mode 100644 index 0000000000000..8486a46efdd10 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImagesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for GalleryImages Delete. */ +public final class GalleryImagesDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/DeleteAGalleryImage.json + */ + /** + * Sample code: Delete a gallery image. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteAGalleryImage(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryImages() + .delete("myResourceGroup", "myGalleryName", "myGalleryImageName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImagesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImagesGetSamples.java new file mode 100644 index 0000000000000..00b713c125b1c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImagesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for GalleryImages Get. */ +public final class GalleryImagesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/GetAGalleryImage.json + */ + /** + * Sample code: Get a gallery image. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAGalleryImage(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryImages() + .getWithResponse("myResourceGroup", "myGalleryName", "myGalleryImageName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImagesListByGallerySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImagesListByGallerySamples.java new file mode 100644 index 0000000000000..bf066b9d3571a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImagesListByGallerySamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for GalleryImages ListByGallery. */ +public final class GalleryImagesListByGallerySamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/ListGalleryImagesInAGallery.json + */ + /** + * Sample code: List gallery images in a gallery. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listGalleryImagesInAGallery(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryImages() + .listByGallery("myResourceGroup", "myGalleryName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImagesUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImagesUpdateSamples.java new file mode 100644 index 0000000000000..41a920a9189bb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GalleryImagesUpdateSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.GalleryImageIdentifier; +import com.azure.resourcemanager.compute.models.GalleryImageUpdate; +import com.azure.resourcemanager.compute.models.HyperVGeneration; +import com.azure.resourcemanager.compute.models.OperatingSystemStateTypes; +import com.azure.resourcemanager.compute.models.OperatingSystemTypes; + +/** Samples for GalleryImages Update. */ +public final class GalleryImagesUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/UpdateASimpleGalleryImage.json + */ + /** + * Sample code: Update a simple gallery image. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateASimpleGalleryImage(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGalleryImages() + .update( + "myResourceGroup", + "myGalleryName", + "myGalleryImageName", + new GalleryImageUpdate() + .withOsType(OperatingSystemTypes.WINDOWS) + .withOsState(OperatingSystemStateTypes.GENERALIZED) + .withHyperVGeneration(HyperVGeneration.V1) + .withIdentifier( + new GalleryImageIdentifier() + .withPublisher("myPublisherName") + .withOffer("myOfferName") + .withSku("mySkuName")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GallerySharingProfileUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GallerySharingProfileUpdateSamples.java new file mode 100644 index 0000000000000..a7289e20d84b4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/GallerySharingProfileUpdateSamples.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.SharingUpdateInner; +import com.azure.resourcemanager.compute.models.SharingProfileGroup; +import com.azure.resourcemanager.compute.models.SharingProfileGroupTypes; +import com.azure.resourcemanager.compute.models.SharingUpdateOperationTypes; +import java.util.Arrays; + +/** Samples for GallerySharingProfile Update. */ +public final class GallerySharingProfileUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/ResetSharingProfileInAGallery.json + */ + /** + * Sample code: reset sharing profile of a gallery. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void resetSharingProfileOfAGallery(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGallerySharingProfiles() + .update( + "myResourceGroup", + "myGalleryName", + new SharingUpdateInner().withOperationType(SharingUpdateOperationTypes.RESET), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/gallery/AddToSharingProfileInAGallery.json + */ + /** + * Sample code: Add sharing id to the sharing profile of a gallery. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void addSharingIdToTheSharingProfileOfAGallery(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getGallerySharingProfiles() + .update( + "myResourceGroup", + "myGalleryName", + new SharingUpdateInner() + .withOperationType(SharingUpdateOperationTypes.ADD) + .withGroups( + Arrays + .asList( + new SharingProfileGroup() + .withType(SharingProfileGroupTypes.SUBSCRIPTIONS) + .withIds( + Arrays + .asList( + "34a4ab42-0d72-47d9-bd1a-aed207386dac", + "380fd389-260b-41aa-bad9-0a83108c370b")), + new SharingProfileGroup() + .withType(SharingProfileGroupTypes.AADTENANTS) + .withIds(Arrays.asList("c24c76aa-8897-4027-9b03-8f7928b54ff6")))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ImagesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ImagesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..0fd1d9479bb41 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ImagesCreateOrUpdateSamples.java @@ -0,0 +1,375 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.ImageInner; +import com.azure.resourcemanager.compute.models.DiskEncryptionSetParameters; +import com.azure.resourcemanager.compute.models.ImageDataDisk; +import com.azure.resourcemanager.compute.models.ImageOSDisk; +import com.azure.resourcemanager.compute.models.ImageStorageProfile; +import com.azure.resourcemanager.compute.models.OperatingSystemStateTypes; +import com.azure.resourcemanager.compute.models.OperatingSystemTypes; +import java.util.Arrays; + +/** Samples for Images CreateOrUpdate. */ +public final class ImagesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAnImageFromASnapshot.json + */ + /** + * Sample code: Create a virtual machine image from a snapshot. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVirtualMachineImageFromASnapshot(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getImages() + .createOrUpdate( + "myResourceGroup", + "myImage", + new ImageInner() + .withLocation("West US") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withSnapshot( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")) + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED)) + .withZoneResilient(false)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAnImageFromAManagedDisk.json + */ + /** + * Sample code: Create a virtual machine image from a managed disk. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVirtualMachineImageFromAManagedDisk( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getImages() + .createOrUpdate( + "myResourceGroup", + "myImage", + new ImageInner() + .withLocation("West US") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withManagedDisk( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk")) + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED)) + .withZoneResilient(true)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAnImageFromABlobWithDiskEncryptionSet.json + */ + /** + * Sample code: Create a virtual machine image from a blob with DiskEncryptionSet resource. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVirtualMachineImageFromABlobWithDiskEncryptionSetResource( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getImages() + .createOrUpdate( + "myResourceGroup", + "myImage", + new ImageInner() + .withLocation("West US") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withBlobUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd") + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")) + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAnImageFromAManagedDiskWithDiskEncryptionSet.json + */ + /** + * Sample code: Create a virtual machine image from a managed disk with DiskEncryptionSet resource. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVirtualMachineImageFromAManagedDiskWithDiskEncryptionSetResource( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getImages() + .createOrUpdate( + "myResourceGroup", + "myImage", + new ImageInner() + .withLocation("West US") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withManagedDisk( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk")) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")) + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAnImageThatIncludesADataDiskFromABlob.json + */ + /** + * Sample code: Create a virtual machine image that includes a data disk from a blob. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVirtualMachineImageThatIncludesADataDiskFromABlob( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getImages() + .createOrUpdate( + "myResourceGroup", + "myImage", + new ImageInner() + .withLocation("West US") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withBlobUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd") + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED)) + .withDataDisks( + Arrays + .asList( + new ImageDataDisk() + .withBlobUri( + "https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd") + .withLun(1))) + .withZoneResilient(false)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAnImageFromASnapshotWithDiskEncryptionSet.json + */ + /** + * Sample code: Create a virtual machine image from a snapshot with DiskEncryptionSet resource. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVirtualMachineImageFromASnapshotWithDiskEncryptionSetResource( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getImages() + .createOrUpdate( + "myResourceGroup", + "myImage", + new ImageInner() + .withLocation("West US") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withSnapshot( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")) + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAnImageThatIncludesADataDiskFromASnapshot.json + */ + /** + * Sample code: Create a virtual machine image that includes a data disk from a snapshot. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVirtualMachineImageThatIncludesADataDiskFromASnapshot( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getImages() + .createOrUpdate( + "myResourceGroup", + "myImage", + new ImageInner() + .withLocation("West US") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withSnapshot( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot")) + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED)) + .withDataDisks( + Arrays + .asList( + new ImageDataDisk() + .withSnapshot( + new SubResource() + .withId( + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2")) + .withLun(1))) + .withZoneResilient(true)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAnImageFromABlob.json + */ + /** + * Sample code: Create a virtual machine image from a blob. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVirtualMachineImageFromABlob(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getImages() + .createOrUpdate( + "myResourceGroup", + "myImage", + new ImageInner() + .withLocation("West US") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withBlobUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd") + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED)) + .withZoneResilient(true)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAnImageFromAVM.json + */ + /** + * Sample code: Create a virtual machine image from an existing virtual machine. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVirtualMachineImageFromAnExistingVirtualMachine( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getImages() + .createOrUpdate( + "myResourceGroup", + "myImage", + new ImageInner() + .withLocation("West US") + .withSourceVirtualMachine( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAnImageThatIncludesADataDiskFromAManagedDisk.json + */ + /** + * Sample code: Create a virtual machine image that includes a data disk from a managed disk. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVirtualMachineImageThatIncludesADataDiskFromAManagedDisk( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getImages() + .createOrUpdate( + "myResourceGroup", + "myImage", + new ImageInner() + .withLocation("West US") + .withStorageProfile( + new ImageStorageProfile() + .withOsDisk( + new ImageOSDisk() + .withManagedDisk( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk")) + .withOsType(OperatingSystemTypes.LINUX) + .withOsState(OperatingSystemStateTypes.GENERALIZED)) + .withDataDisks( + Arrays + .asList( + new ImageDataDisk() + .withManagedDisk( + new SubResource() + .withId( + "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2")) + .withLun(1))) + .withZoneResilient(false)), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ImagesGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ImagesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..0b652d8afbfe4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ImagesGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for Images GetByResourceGroup. */ +public final class ImagesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GetInformationAboutAnImage.json + */ + /** + * Sample code: Get information about a virtual machine image. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getInformationAboutAVirtualMachineImage(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getImages() + .getByResourceGroupWithResponse("myResourceGroup", "myImage", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ImagesListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ImagesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..899f3cd8aa356 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ImagesListByResourceGroupSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for Images ListByResourceGroup. */ +public final class ImagesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/ListImagesInAResourceGroup.json + */ + /** + * Sample code: List all virtual machine images in a resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllVirtualMachineImagesInAResourceGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getImages() + .listByResourceGroup("myResourceGroup", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ImagesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ImagesListSamples.java new file mode 100644 index 0000000000000..d107e05dc19bb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ImagesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for Images List. */ +public final class ImagesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/ListImagesInASubscription.json + */ + /** + * Sample code: List all virtual machine images in a subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllVirtualMachineImagesInASubscription( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.virtualMachines().manager().serviceClient().getImages().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ImagesUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ImagesUpdateSamples.java new file mode 100644 index 0000000000000..21634e30e59ed --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ImagesUpdateSamples.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.HyperVGenerationTypes; +import com.azure.resourcemanager.compute.models.ImageUpdate; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Images Update. */ +public final class ImagesUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/UpdateImage.json + */ + /** + * Sample code: Updates tags of an Image. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updatesTagsOfAnImage(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getImages() + .update( + "myResourceGroup", + "myImage", + new ImageUpdate() + .withTags(mapOf("department", "HR")) + .withSourceVirtualMachine( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM")) + .withHyperVGeneration(HyperVGenerationTypes.V1), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/LogAnalyticsExportRequestRateByIntervalSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/LogAnalyticsExportRequestRateByIntervalSamples.java new file mode 100644 index 0000000000000..15f821159cf4d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/LogAnalyticsExportRequestRateByIntervalSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.IntervalInMins; +import com.azure.resourcemanager.compute.models.RequestRateByIntervalInput; +import java.time.OffsetDateTime; + +/** Samples for LogAnalytics ExportRequestRateByInterval. */ +public final class LogAnalyticsExportRequestRateByIntervalSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/LogAnalyticsRequestRateByInterval.json + */ + /** + * Sample code: Export logs which contain all Api requests made to Compute Resource Provider within the given time + * period broken down by intervals. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void + exportLogsWhichContainAllApiRequestsMadeToComputeResourceProviderWithinTheGivenTimePeriodBrokenDownByIntervals( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getLogAnalytics() + .exportRequestRateByInterval( + "westus", + new RequestRateByIntervalInput() + .withBlobContainerSasUri("https://somesasuri") + .withFromTime(OffsetDateTime.parse("2018-01-21T01:54:06.862601Z")) + .withToTime(OffsetDateTime.parse("2018-01-23T01:54:06.862601Z")) + .withGroupByResourceName(true) + .withIntervalLength(IntervalInMins.FIVE_MINS), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/LogAnalyticsExportThrottledRequestsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/LogAnalyticsExportThrottledRequestsSamples.java new file mode 100644 index 0000000000000..0d3ecdf68d9e8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/LogAnalyticsExportThrottledRequestsSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.ThrottledRequestsInput; +import java.time.OffsetDateTime; + +/** Samples for LogAnalytics ExportThrottledRequests. */ +public final class LogAnalyticsExportThrottledRequestsSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/LogAnalyticsThrottledRequests.json + */ + /** + * Sample code: Export logs which contain all throttled Api requests made to Compute Resource Provider within the + * given time period. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void + exportLogsWhichContainAllThrottledApiRequestsMadeToComputeResourceProviderWithinTheGivenTimePeriod( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getLogAnalytics() + .exportThrottledRequests( + "westus", + new ThrottledRequestsInput() + .withBlobContainerSasUri("https://somesasuri") + .withFromTime(OffsetDateTime.parse("2018-01-21T01:54:06.862601Z")) + .withToTime(OffsetDateTime.parse("2018-01-23T01:54:06.862601Z")) + .withGroupByOperationName(true) + .withGroupByResourceName(false) + .withGroupByClientApplicationId(false) + .withGroupByUserAgent(false), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ProximityPlacementGroupsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ProximityPlacementGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..5c80c6a27e796 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ProximityPlacementGroupsCreateOrUpdateSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.ProximityPlacementGroupInner; +import com.azure.resourcemanager.compute.models.ProximityPlacementGroupType; + +/** Samples for ProximityPlacementGroups CreateOrUpdate. */ +public final class ProximityPlacementGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateOrUpdateAProximityPlacementGroup.json + */ + /** + * Sample code: Create or Update a proximity placement group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateAProximityPlacementGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getProximityPlacementGroups() + .createOrUpdateWithResponse( + "myResourceGroup", + "myProximityPlacementGroup", + new ProximityPlacementGroupInner() + .withLocation("westus") + .withProximityPlacementGroupType(ProximityPlacementGroupType.STANDARD), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ProximityPlacementGroupsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ProximityPlacementGroupsDeleteSamples.java new file mode 100644 index 0000000000000..9c5c47794a920 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ProximityPlacementGroupsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for ProximityPlacementGroups Delete. */ +public final class ProximityPlacementGroupsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/DeleteAProximityPlacementGroup.json + */ + /** + * Sample code: Create a proximity placement group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAProximityPlacementGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getProximityPlacementGroups() + .deleteWithResponse("myResourceGroup", "myProximityPlacementGroup", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ProximityPlacementGroupsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ProximityPlacementGroupsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..a564867a70a8a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ProximityPlacementGroupsGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for ProximityPlacementGroups GetByResourceGroup. */ +public final class ProximityPlacementGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GetAProximityPlacementGroup.json + */ + /** + * Sample code: Create a proximity placement group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAProximityPlacementGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getProximityPlacementGroups() + .getByResourceGroupWithResponse("myResourceGroup", "myProximityPlacementGroup", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ProximityPlacementGroupsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ProximityPlacementGroupsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..8fac8d9d6488d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ProximityPlacementGroupsListByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for ProximityPlacementGroups ListByResourceGroup. */ +public final class ProximityPlacementGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/ListProximityPlacementGroupsInAResourceGroup.json + */ + /** + * Sample code: Create a proximity placement group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAProximityPlacementGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getProximityPlacementGroups() + .listByResourceGroup("myResourceGroup", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ProximityPlacementGroupsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ProximityPlacementGroupsListSamples.java new file mode 100644 index 0000000000000..6e4333f91291c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ProximityPlacementGroupsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for ProximityPlacementGroups List. */ +public final class ProximityPlacementGroupsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/ListProximityPlacementGroupsInASubscription.json + */ + /** + * Sample code: Create a proximity placement group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAProximityPlacementGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.virtualMachines().manager().serviceClient().getProximityPlacementGroups().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ProximityPlacementGroupsUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ProximityPlacementGroupsUpdateSamples.java new file mode 100644 index 0000000000000..03277d5e3ea19 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ProximityPlacementGroupsUpdateSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.ProximityPlacementGroupUpdate; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ProximityPlacementGroups Update. */ +public final class ProximityPlacementGroupsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/PatchAProximityPlacementGroup.json + */ + /** + * Sample code: Create a proximity placement group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAProximityPlacementGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getProximityPlacementGroups() + .updateWithResponse( + "myResourceGroup", + "myProximityPlacementGroup", + new ProximityPlacementGroupUpdate().withTags(mapOf("additionalProp1", "string")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ResourceSkusListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ResourceSkusListSamples.java new file mode 100644 index 0000000000000..2c8e8fd5ef067 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/ResourceSkusListSamples.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for ResourceSkus List. */ +public final class ResourceSkusListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/skus/ListAvailableResourceSkus.json + */ + /** + * Sample code: Lists all available Resource SKUs. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listsAllAvailableResourceSKUs(com.azure.resourcemanager.AzureResourceManager azure) { + azure.virtualMachines().manager().serviceClient().getResourceSkus().list(null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/skus/ListAvailableResourceSkusForARegion.json + */ + /** + * Sample code: Lists all available Resource SKUs for the specified region. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listsAllAvailableResourceSKUsForTheSpecifiedRegion( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getResourceSkus() + .list("location eq 'westus'", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/skus/ListAvailableResourceSkusWithExtendedLocations.json + */ + /** + * Sample code: Lists all available Resource SKUs with Extended Location information. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listsAllAvailableResourceSKUsWithExtendedLocationInformation( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.virtualMachines().manager().serviceClient().getResourceSkus().list(null, "true", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/RestorePointCollectionsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/RestorePointCollectionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..5280aaaf5383c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/RestorePointCollectionsCreateOrUpdateSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.RestorePointCollectionInner; +import com.azure.resourcemanager.compute.models.RestorePointCollectionSourceProperties; +import java.util.HashMap; +import java.util.Map; + +/** Samples for RestorePointCollections CreateOrUpdate. */ +public final class RestorePointCollectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateOrUpdateARestorePointCollection.json + */ + /** + * Sample code: Create or update a restore point collection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateARestorePointCollection(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getRestorePointCollections() + .createOrUpdateWithResponse( + "myResourceGroup", + "myRpc", + new RestorePointCollectionInner() + .withLocation("norwayeast") + .withTags(mapOf("myTag1", "tagValue1")) + .withSource( + new RestorePointCollectionSourceProperties() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/RestorePointCollectionsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/RestorePointCollectionsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..fccb238a4c7de --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/RestorePointCollectionsGetByResourceGroupSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorePointCollections GetByResourceGroup. */ +public final class RestorePointCollectionsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GetRestorePointCollectionWithContainedRestorePoints.json + */ + /** + * Sample code: Get a restore point collection, including the restore points contained in the restore point + * collection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getARestorePointCollectionIncludingTheRestorePointsContainedInTheRestorePointCollection( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getRestorePointCollections() + .getByResourceGroupWithResponse("myResourceGroup", "rpcName", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GetRestorePointCollection.json + */ + /** + * Sample code: Get a restore point collection (but not the restore points contained in the restore point + * collection). + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getARestorePointCollectionButNotTheRestorePointsContainedInTheRestorePointCollection( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getRestorePointCollections() + .getByResourceGroupWithResponse("myResourceGroup", "myRpc", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/RestorePointCollectionsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/RestorePointCollectionsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..9050f965ed4ed --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/RestorePointCollectionsListByResourceGroupSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorePointCollections ListByResourceGroup. */ +public final class RestorePointCollectionsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GetRestorePointCollectionsInAResourceGroup.json + */ + /** + * Sample code: Gets the list of restore point collections in a resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getsTheListOfRestorePointCollectionsInAResourceGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getRestorePointCollections() + .listByResourceGroup("myResourceGroup", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/RestorePointCollectionsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/RestorePointCollectionsListSamples.java new file mode 100644 index 0000000000000..0c04da95a81c7 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/RestorePointCollectionsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorePointCollections List. */ +public final class RestorePointCollectionsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GetRestorePointCollectionsInASubscription.json + */ + /** + * Sample code: Gets the list of restore point collections in a subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getsTheListOfRestorePointCollectionsInASubscription( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.virtualMachines().manager().serviceClient().getRestorePointCollections().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/RestorePointsCreateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/RestorePointsCreateSamples.java new file mode 100644 index 0000000000000..43f929407cec4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/RestorePointsCreateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.RestorePointInner; +import com.azure.resourcemanager.compute.models.ApiEntityReference; +import java.util.Arrays; + +/** Samples for RestorePoints Create. */ +public final class RestorePointsCreateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateARestorePoint.json + */ + /** + * Sample code: Create a restore point. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createARestorePoint(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getRestorePoints() + .create( + "myResourceGroup", + "rpcName", + "rpName", + new RestorePointInner() + .withExcludeDisks( + Arrays + .asList( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123"))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/RestorePointsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/RestorePointsGetSamples.java new file mode 100644 index 0000000000000..d957b1410528f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/RestorePointsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorePoints Get. */ +public final class RestorePointsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GetRestorePoint.json + */ + /** + * Sample code: Get a restore point. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getARestorePoint(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getRestorePoints() + .getWithResponse("myResourceGroup", "rpcName", "rpName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SharedGalleriesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SharedGalleriesGetSamples.java new file mode 100644 index 0000000000000..628be8e3b1004 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SharedGalleriesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for SharedGalleries Get. */ +public final class SharedGalleriesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/sharedGallery/GetASharedGallery.json + */ + /** + * Sample code: Get a gallery. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAGallery(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getSharedGalleries() + .getWithResponse("myLocation", "galleryUniqueName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SharedGalleriesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SharedGalleriesListSamples.java new file mode 100644 index 0000000000000..79a6276f60d42 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SharedGalleriesListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for SharedGalleries List. */ +public final class SharedGalleriesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/sharedGallery/ListSharedGalleries.json + */ + /** + * Sample code: Get a gallery. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAGallery(com.azure.resourcemanager.AzureResourceManager azure) { + azure.virtualMachines().manager().serviceClient().getSharedGalleries().list("myLocation", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SharedGalleryImageVersionsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SharedGalleryImageVersionsGetSamples.java new file mode 100644 index 0000000000000..9807d36b121f9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SharedGalleryImageVersionsGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for SharedGalleryImageVersions Get. */ +public final class SharedGalleryImageVersionsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/sharedGallery/GetASharedGalleryImageVersion.json + */ + /** + * Sample code: Get a gallery. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAGallery(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getSharedGalleryImageVersions() + .getWithResponse( + "myLocation", "galleryUniqueName", "myGalleryImageName", "myGalleryImageVersionName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SharedGalleryImageVersionsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SharedGalleryImageVersionsListSamples.java new file mode 100644 index 0000000000000..95d7c44a32df1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SharedGalleryImageVersionsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for SharedGalleryImageVersions List. */ +public final class SharedGalleryImageVersionsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/sharedGallery/ListSharedGalleryImageVersions.json + */ + /** + * Sample code: Get a gallery. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAGallery(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getSharedGalleryImageVersions() + .list("myLocation", "galleryUniqueName", "myGalleryImageName", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SharedGalleryImagesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SharedGalleryImagesGetSamples.java new file mode 100644 index 0000000000000..1583ad6a0bda7 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SharedGalleryImagesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for SharedGalleryImages Get. */ +public final class SharedGalleryImagesGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/sharedGallery/GetASharedGalleryImage.json + */ + /** + * Sample code: Get a gallery. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAGallery(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getSharedGalleryImages() + .getWithResponse("myLocation", "galleryUniqueName", "myGalleryImageName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SharedGalleryImagesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SharedGalleryImagesListSamples.java new file mode 100644 index 0000000000000..db3a0ef27aed3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SharedGalleryImagesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for SharedGalleryImages List. */ +public final class SharedGalleryImagesListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/sharedGallery/ListSharedGalleryImages.json + */ + /** + * Sample code: Get a gallery. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAGallery(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getSharedGalleryImages() + .list("myLocation", "galleryUniqueName", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..a8db273d5b3e9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsCreateOrUpdateSamples.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.SnapshotInner; +import com.azure.resourcemanager.compute.models.CreationData; +import com.azure.resourcemanager.compute.models.DiskCreateOption; + +/** Samples for Snapshots CreateOrUpdate. */ +public final class SnapshotsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/CreateASnapshotFromAnExistingSnapshot.json + */ + /** + * Sample code: Create a snapshot from an existing snapshot in the same or a different subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscription( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getSnapshots() + .createOrUpdate( + "myResourceGroup", + "mySnapshot2", + new SnapshotInner() + .withLocation("West US") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.COPY) + .withSourceResourceId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/CreateASnapshotFromAnExistingSnapshotInDifferentRegion.json + */ + /** + * Sample code: Create a snapshot from an existing snapshot in the same or a different subscription in a different + * region. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegion( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getSnapshots() + .createOrUpdate( + "myResourceGroup", + "mySnapshot2", + new SnapshotInner() + .withLocation("West US") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.COPY_START) + .withSourceResourceId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/CreateASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription.json + */ + /** + * Sample code: Create a snapshot by importing an unmanaged blob from the same subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getSnapshots() + .createOrUpdate( + "myResourceGroup", + "mySnapshot1", + new SnapshotInner() + .withLocation("West US") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.IMPORT) + .withSourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/CreateASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription.json + */ + /** + * Sample code: Create a snapshot by importing an unmanaged blob from a different subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getSnapshots() + .createOrUpdate( + "myResourceGroup", + "mySnapshot1", + new SnapshotInner() + .withLocation("West US") + .withCreationData( + new CreationData() + .withCreateOption(DiskCreateOption.IMPORT) + .withStorageAccountId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount") + .withSourceUri("https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsDeleteSamples.java new file mode 100644 index 0000000000000..05cd430a9719f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for Snapshots Delete. */ +public final class SnapshotsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/DeleteASnapshot.json + */ + /** + * Sample code: Delete a snapshot. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteASnapshot(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getSnapshots() + .delete("myResourceGroup", "mySnapshot", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..a367a617587df --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for Snapshots GetByResourceGroup. */ +public final class SnapshotsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/GetInformationAboutASnapshot.json + */ + /** + * Sample code: Get information about a snapshot. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getInformationAboutASnapshot(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getSnapshots() + .getByResourceGroupWithResponse("myResourceGroup", "mySnapshot", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsGrantAccessSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsGrantAccessSamples.java new file mode 100644 index 0000000000000..948bc75aa3359 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsGrantAccessSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.AccessLevel; +import com.azure.resourcemanager.compute.models.GrantAccessData; + +/** Samples for Snapshots GrantAccess. */ +public final class SnapshotsGrantAccessSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/BeginGetAccessSnapshot.json + */ + /** + * Sample code: Get a sas on a snapshot. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getASasOnASnapshot(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getSnapshots() + .grantAccess( + "myResourceGroup", + "mySnapshot", + new GrantAccessData().withAccess(AccessLevel.READ).withDurationInSeconds(300), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..a741213f3851d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsListByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for Snapshots ListByResourceGroup. */ +public final class SnapshotsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/ListSnapshotsInAResourceGroup.json + */ + /** + * Sample code: List all snapshots in a resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllSnapshotsInAResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getSnapshots() + .listByResourceGroup("myResourceGroup", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsListSamples.java new file mode 100644 index 0000000000000..a8323af0c7b0b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for Snapshots List. */ +public final class SnapshotsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/ListSnapshotsInASubscription.json + */ + /** + * Sample code: List all snapshots in a subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllSnapshotsInASubscription(com.azure.resourcemanager.AzureResourceManager azure) { + azure.virtualMachines().manager().serviceClient().getSnapshots().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsRevokeAccessSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsRevokeAccessSamples.java new file mode 100644 index 0000000000000..83f9ca31baf98 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsRevokeAccessSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for Snapshots RevokeAccess. */ +public final class SnapshotsRevokeAccessSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/EndGetAccessSnapshot.json + */ + /** + * Sample code: Revoke access to a snapshot. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void revokeAccessToASnapshot(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getSnapshots() + .revokeAccess("myResourceGroup", "mySnapshot", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsUpdateSamples.java new file mode 100644 index 0000000000000..c21e1ad4080fb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SnapshotsUpdateSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.SnapshotUpdate; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Snapshots Update. */ +public final class SnapshotsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-04-01/examples/UpdateASnapshot.json + */ + /** + * Sample code: Update a snapshot. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateASnapshot(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getSnapshots() + .update( + "myResourceGroup", + "mySnapshot", + new SnapshotUpdate() + .withTags(mapOf("department", "Development", "project", "UpdateSnapshots")) + .withDiskSizeGB(20), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SshPublicKeysCreateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SshPublicKeysCreateSamples.java new file mode 100644 index 0000000000000..d47f99e019a92 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SshPublicKeysCreateSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.SshPublicKeyResourceInner; + +/** Samples for SshPublicKeys Create. */ +public final class SshPublicKeysCreateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAnSshPublicKey.json + */ + /** + * Sample code: Create a new SSH public key resource. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createANewSSHPublicKeyResource(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getSshPublicKeys() + .createWithResponse( + "myResourceGroup", + "mySshPublicKeyName", + new SshPublicKeyResourceInner().withLocation("westus").withPublicKey("{ssh-rsa public key}"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SshPublicKeysGenerateKeyPairSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SshPublicKeysGenerateKeyPairSamples.java new file mode 100644 index 0000000000000..4a1faea066f4f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SshPublicKeysGenerateKeyPairSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for SshPublicKeys GenerateKeyPair. */ +public final class SshPublicKeysGenerateKeyPairSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GenerateSshKeyPair.json + */ + /** + * Sample code: Generate an SSH key pair. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void generateAnSSHKeyPair(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getSshPublicKeys() + .generateKeyPairWithResponse("myResourceGroup", "mySshPublicKeyName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SshPublicKeysGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SshPublicKeysGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..49027321443cd --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/SshPublicKeysGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for SshPublicKeys GetByResourceGroup. */ +public final class SshPublicKeysGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GetAnSshPublicKey.json + */ + /** + * Sample code: Get an ssh public key. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAnSshPublicKey(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getSshPublicKeys() + .getByResourceGroupWithResponse("myResourceGroup", "mySshPublicKeyName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineExtensionsUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineExtensionsUpdateSamples.java new file mode 100644 index 0000000000000..0cabf4eeaf297 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineExtensionsUpdateSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.compute.models.VirtualMachineExtensionUpdate; +import java.io.IOException; + +/** Samples for VirtualMachineExtensions Update. */ +public final class VirtualMachineExtensionsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/UpdateVMExtensionWithSuppressFailureEnabled.json + */ + /** + * Sample code: Update VM extension. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateVMExtension(com.azure.resourcemanager.AzureResourceManager azure) throws IOException { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineExtensions() + .update( + "myResourceGroup", + "myVM", + "myVMExtension", + new VirtualMachineExtensionUpdate() + .withPublisher("extPublisher") + .withType("extType") + .withTypeHandlerVersion("1.2") + .withAutoUpgradeMinorVersion(true) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{\"UserName\":\"xyz@microsoft.com\"}", Object.class, SerializerEncoding.JSON)) + .withSuppressFailures(true), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineRunCommandsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineRunCommandsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..c994bd9aed1dc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineRunCommandsCreateOrUpdateSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.VirtualMachineRunCommandInner; +import com.azure.resourcemanager.compute.models.RunCommandInputParameter; +import com.azure.resourcemanager.compute.models.VirtualMachineRunCommandScriptSource; +import java.util.Arrays; + +/** Samples for VirtualMachineRunCommands CreateOrUpdate. */ +public final class VirtualMachineRunCommandsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/runCommands/CreateOrUpdateRunCommand.json + */ + /** + * Sample code: Create or update a run command. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateARunCommand(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineRunCommands() + .createOrUpdate( + "myResourceGroup", + "myVM", + "myRunCommand", + new VirtualMachineRunCommandInner() + .withLocation("West US") + .withSource(new VirtualMachineRunCommandScriptSource().withScript("Write-Host Hello World!")) + .withParameters( + Arrays + .asList( + new RunCommandInputParameter().withName("param1").withValue("value1"), + new RunCommandInputParameter().withName("param2").withValue("value2"))) + .withAsyncExecution(false) + .withRunAsUser("user1") + .withRunAsPassword("") + .withTimeoutInSeconds(3600), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineRunCommandsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineRunCommandsDeleteSamples.java new file mode 100644 index 0000000000000..c9ecd75ad8528 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineRunCommandsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineRunCommands Delete. */ +public final class VirtualMachineRunCommandsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/runCommands/DeleteRunCommand.json + */ + /** + * Sample code: Delete a run command. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteARunCommand(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineRunCommands() + .delete("myResourceGroup", "myVM", "myRunCommand", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineRunCommandsGetByVirtualMachineSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineRunCommandsGetByVirtualMachineSamples.java new file mode 100644 index 0000000000000..e6d34273f767c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineRunCommandsGetByVirtualMachineSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineRunCommands GetByVirtualMachine. */ +public final class VirtualMachineRunCommandsGetByVirtualMachineSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/runCommands/GetRunCommand.json + */ + /** + * Sample code: Get a run command. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getARunCommand(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineRunCommands() + .getByVirtualMachineWithResponse("myResourceGroup", "myVM", "myRunCommand", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineRunCommandsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineRunCommandsGetSamples.java new file mode 100644 index 0000000000000..ef15f67c669ec --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineRunCommandsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineRunCommands Get. */ +public final class VirtualMachineRunCommandsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/runCommands/VirtualMachineRunCommandGet.json + */ + /** + * Sample code: VirtualMachineRunCommandGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualMachineRunCommandGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineRunCommands() + .getWithResponse("SoutheastAsia", "RunPowerShellScript", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineRunCommandsListByVirtualMachineSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineRunCommandsListByVirtualMachineSamples.java new file mode 100644 index 0000000000000..64e8a14e0c181 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineRunCommandsListByVirtualMachineSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineRunCommands ListByVirtualMachine. */ +public final class VirtualMachineRunCommandsListByVirtualMachineSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/runCommands/ListRunCommandsInVM.json + */ + /** + * Sample code: List run commands in a Virtual Machine. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listRunCommandsInAVirtualMachine(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineRunCommands() + .listByVirtualMachine("myResourceGroup", "myVM", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineRunCommandsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineRunCommandsListSamples.java new file mode 100644 index 0000000000000..828ed8fbb962d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineRunCommandsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineRunCommands List. */ +public final class VirtualMachineRunCommandsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/runCommands/VirtualMachineRunCommandList.json + */ + /** + * Sample code: VirtualMachineRunCommandList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualMachineRunCommandList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineRunCommands() + .list("SoutheastAsia", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineRunCommandsUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineRunCommandsUpdateSamples.java new file mode 100644 index 0000000000000..deab555352922 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineRunCommandsUpdateSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.VirtualMachineRunCommandScriptSource; +import com.azure.resourcemanager.compute.models.VirtualMachineRunCommandUpdate; + +/** Samples for VirtualMachineRunCommands Update. */ +public final class VirtualMachineRunCommandsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/runCommands/UpdateRunCommand.json + */ + /** + * Sample code: Update a run command. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateARunCommand(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineRunCommands() + .update( + "myResourceGroup", + "myVM", + "myRunCommand", + new VirtualMachineRunCommandUpdate() + .withSource( + new VirtualMachineRunCommandScriptSource().withScript("Write-Host Script Source Updated!")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSamples.java new file mode 100644 index 0000000000000..a2432f63c8528 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetRollingUpgrades StartExtensionUpgrade. */ +public final class VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/VMScaleSetExtensionRollingUpgrade.json + */ + /** + * Sample code: Start an extension rolling upgrade. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void startAnExtensionRollingUpgrade(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSetRollingUpgrades() + .startExtensionUpgrade("myResourceGroup", "{vmss-name}", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMExtensionsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMExtensionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..2f97d44b66751 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMExtensionsCreateOrUpdateSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.compute.fluent.models.VirtualMachineScaleSetVMExtensionInner; +import java.io.IOException; + +/** Samples for VirtualMachineScaleSetVMExtensions CreateOrUpdate. */ +public final class VirtualMachineScaleSetVMExtensionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateOrUpdateVirtualMachineScaleSetVMExtensions.json + */ + /** + * Sample code: Create VirtualMachineScaleSet VM extension. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createVirtualMachineScaleSetVMExtension(com.azure.resourcemanager.AzureResourceManager azure) + throws IOException { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSetVMExtensions() + .createOrUpdate( + "myResourceGroup", + "myvmScaleSet", + "0", + "myVMExtension", + new VirtualMachineScaleSetVMExtensionInner() + .withPublisher("extPublisher") + .withTypePropertiesType("extType") + .withTypeHandlerVersion("1.2") + .withAutoUpgradeMinorVersion(true) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"UserName\":\"xyz@microsoft.com\"}", Object.class, SerializerEncoding.JSON)), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMExtensionsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMExtensionsDeleteSamples.java new file mode 100644 index 0000000000000..2dee6ffdd5879 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMExtensionsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMExtensions Delete. */ +public final class VirtualMachineScaleSetVMExtensionsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/DeleteVirtualMachineScaleSetVMExtensions.json + */ + /** + * Sample code: Delete VirtualMachineScaleSet VM extension. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteVirtualMachineScaleSetVMExtension(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSetVMExtensions() + .delete("myResourceGroup", "myvmScaleSet", "0", "myVMExtension", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMExtensionsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMExtensionsGetSamples.java new file mode 100644 index 0000000000000..2b67800da1ffb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMExtensionsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMExtensions Get. */ +public final class VirtualMachineScaleSetVMExtensionsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GetVirtualMachineScaleSetVMExtensions.json + */ + /** + * Sample code: Get VirtualMachineScaleSet VM extension. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualMachineScaleSetVMExtension(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSetVMExtensions() + .getWithResponse("myResourceGroup", "myvmScaleSet", "0", "myVMExtension", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMExtensionsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMExtensionsListSamples.java new file mode 100644 index 0000000000000..7136af288fe73 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMExtensionsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMExtensions List. */ +public final class VirtualMachineScaleSetVMExtensionsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/ListVirtualMachineScaleSetVMExtensions.json + */ + /** + * Sample code: List extensions in Vmss instance. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listExtensionsInVmssInstance(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSetVMExtensions() + .listWithResponse("myResourceGroup", "myvmScaleSet", "0", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMExtensionsUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMExtensionsUpdateSamples.java new file mode 100644 index 0000000000000..7a7eeccbee989 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMExtensionsUpdateSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetVMExtensionUpdate; +import java.io.IOException; + +/** Samples for VirtualMachineScaleSetVMExtensions Update. */ +public final class VirtualMachineScaleSetVMExtensionsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/UpdateVirtualMachineScaleSetVMExtensions.json + */ + /** + * Sample code: Update VirtualMachineScaleSet VM extension. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateVirtualMachineScaleSetVMExtension(com.azure.resourcemanager.AzureResourceManager azure) + throws IOException { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSetVMExtensions() + .update( + "myResourceGroup", + "myvmScaleSet", + "0", + "myVMExtension", + new VirtualMachineScaleSetVMExtensionUpdate() + .withPublisher("extPublisher") + .withTypePropertiesType("extType") + .withTypeHandlerVersion("1.2") + .withAutoUpgradeMinorVersion(true) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize( + "{\"UserName\":\"xyz@microsoft.com\"}", Object.class, SerializerEncoding.JSON)), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMRunCommandsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMRunCommandsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..1724a8360a6ec --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMRunCommandsCreateOrUpdateSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.VirtualMachineRunCommandInner; +import com.azure.resourcemanager.compute.models.RunCommandInputParameter; +import com.azure.resourcemanager.compute.models.VirtualMachineRunCommandScriptSource; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSetVMRunCommands CreateOrUpdate. */ +public final class VirtualMachineScaleSetVMRunCommandsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/runCommands/CreateOrUpdateVirtualMachineScaleSetVMRunCommands.json + */ + /** + * Sample code: Create VirtualMachineScaleSet VM run command. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createVirtualMachineScaleSetVMRunCommand(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSetVMRunCommands() + .createOrUpdate( + "myResourceGroup", + "myvmScaleSet", + "0", + "myRunCommand", + new VirtualMachineRunCommandInner() + .withLocation("West US") + .withSource(new VirtualMachineRunCommandScriptSource().withScript("Write-Host Hello World!")) + .withParameters( + Arrays + .asList( + new RunCommandInputParameter().withName("param1").withValue("value1"), + new RunCommandInputParameter().withName("param2").withValue("value2"))) + .withAsyncExecution(false) + .withRunAsUser("user1") + .withRunAsPassword("") + .withTimeoutInSeconds(3600), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMRunCommandsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMRunCommandsDeleteSamples.java new file mode 100644 index 0000000000000..22b94f7824f7f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMRunCommandsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMRunCommands Delete. */ +public final class VirtualMachineScaleSetVMRunCommandsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/runCommands/DeleteVirtualMachineScaleSetVMRunCommands.json + */ + /** + * Sample code: Delete VirtualMachineScaleSet VM run command. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteVirtualMachineScaleSetVMRunCommand(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSetVMRunCommands() + .delete("myResourceGroup", "myvmScaleSet", "0", "myRunCommand", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMRunCommandsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMRunCommandsGetSamples.java new file mode 100644 index 0000000000000..b39eb6111b1b2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMRunCommandsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMRunCommands Get. */ +public final class VirtualMachineScaleSetVMRunCommandsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/runCommands/GetVirtualMachineScaleSetVMRunCommands.json + */ + /** + * Sample code: Get VirtualMachineScaleSet VM run commands. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualMachineScaleSetVMRunCommands(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSetVMRunCommands() + .getWithResponse("myResourceGroup", "myvmScaleSet", "0", "myRunCommand", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMRunCommandsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMRunCommandsListSamples.java new file mode 100644 index 0000000000000..b4684bf93061b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMRunCommandsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMRunCommands List. */ +public final class VirtualMachineScaleSetVMRunCommandsListSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/runCommands/ListVirtualMachineScaleSetVMRunCommands.json + */ + /** + * Sample code: List run commands in Vmss instance. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listRunCommandsInVmssInstance(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSetVMRunCommands() + .list("myResourceGroup", "myvmScaleSet", "0", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMRunCommandsUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMRunCommandsUpdateSamples.java new file mode 100644 index 0000000000000..a7f4ee22596fc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMRunCommandsUpdateSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.VirtualMachineRunCommandScriptSource; +import com.azure.resourcemanager.compute.models.VirtualMachineRunCommandUpdate; + +/** Samples for VirtualMachineScaleSetVMRunCommands Update. */ +public final class VirtualMachineScaleSetVMRunCommandsUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/runCommands/UpdateVirtualMachineScaleSetVMRunCommands.json + */ + /** + * Sample code: Update VirtualMachineScaleSet VM run command. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateVirtualMachineScaleSetVMRunCommand(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSetVMRunCommands() + .update( + "myResourceGroup", + "myvmScaleSet", + "0", + "myRunCommand", + new VirtualMachineRunCommandUpdate() + .withSource( + new VirtualMachineRunCommandScriptSource().withScript("Write-Host Script Source Updated!")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMsDeleteSamples.java new file mode 100644 index 0000000000000..948acd0cb6d49 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs Delete. */ +public final class VirtualMachineScaleSetVMsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/ForceDeleteVirtualMachineScaleSetVM.json + */ + /** + * Sample code: Force Delete a virtual machine from a VM scale set. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void forceDeleteAVirtualMachineFromAVMScaleSet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSetVMs() + .delete("myResourceGroup", "myvmScaleSet", "0", true, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMsGetInstanceViewSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMsGetInstanceViewSamples.java new file mode 100644 index 0000000000000..fdfc66ec65c28 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMsGetInstanceViewSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs GetInstanceView. */ +public final class VirtualMachineScaleSetVMsGetInstanceViewSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GetVirtualMachineScaleSetVMInstanceViewAutoPlacedOnDedicatedHostGroup.json + */ + /** + * Sample code: Get instance view of a virtual machine from a VM scale set placed on a dedicated host group through + * automatic placement. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void + getInstanceViewOfAVirtualMachineFromAVMScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSetVMs() + .getInstanceViewWithResponse("myResourceGroup", "myVirtualMachineScaleSet", "0", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMsGetSamples.java new file mode 100644 index 0000000000000..7e28c293ed0d0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs Get. */ +public final class VirtualMachineScaleSetVMsGetSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GetVirtualMachineScaleSetVMWithUserData.json + */ + /** + * Sample code: Get VM scale set VM with UserData. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVMScaleSetVMWithUserData(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSetVMs() + .getWithResponse("myResourceGroup", "{vmss-name}", "0", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataSamples.java new file mode 100644 index 0000000000000..419f1b9954606 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs RetrieveBootDiagnosticsData. */ +public final class VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/RetrieveBootDiagnosticsDataVMScaleSetVM.json + */ + /** + * Sample code: RetrieveBootDiagnosticsData of a virtual machine. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void retrieveBootDiagnosticsDataOfAVirtualMachine( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSetVMs() + .retrieveBootDiagnosticsDataWithResponse("ResourceGroup", "myvmScaleSet", "0", 60, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMsRunCommandSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMsRunCommandSamples.java new file mode 100644 index 0000000000000..28d1626589312 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMsRunCommandSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.RunCommandInput; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSetVMs RunCommand. */ +public final class VirtualMachineScaleSetVMsRunCommandSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/runCommands/VMScaleSetRunCommand.json + */ + /** + * Sample code: VirtualMachineScaleSetVMs_RunCommand. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualMachineScaleSetVMsRunCommand(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSetVMs() + .runCommand( + "myResourceGroup", + "myVirtualMachineScaleSet", + "0", + new RunCommandInput() + .withCommandId("RunPowerShellScript") + .withScript(Arrays.asList("Write-Host Hello World!")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMsSimulateEvictionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMsSimulateEvictionSamples.java new file mode 100644 index 0000000000000..51040698fb0e9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetVMsSimulateEvictionSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSetVMs SimulateEviction. */ +public final class VirtualMachineScaleSetVMsSimulateEvictionSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/SimulateEvictionOfVmssVM.json + */ + /** + * Sample code: Simulate Eviction a virtual machine. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void simulateEvictionAVirtualMachine(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSetVMs() + .simulateEvictionWithResponse("ResourceGroup", "VmScaleSetName", "InstanceId", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..9c3c5beb69221 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetsCreateOrUpdateSamples.java @@ -0,0 +1,2235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.compute.fluent.models.VirtualMachineScaleSetExtensionInner; +import com.azure.resourcemanager.compute.fluent.models.VirtualMachineScaleSetInner; +import com.azure.resourcemanager.compute.models.ApiEntityReference; +import com.azure.resourcemanager.compute.models.ApplicationProfile; +import com.azure.resourcemanager.compute.models.AutomaticRepairsPolicy; +import com.azure.resourcemanager.compute.models.BillingProfile; +import com.azure.resourcemanager.compute.models.BootDiagnostics; +import com.azure.resourcemanager.compute.models.CachingTypes; +import com.azure.resourcemanager.compute.models.CapacityReservationProfile; +import com.azure.resourcemanager.compute.models.DiagnosticsProfile; +import com.azure.resourcemanager.compute.models.DiffDiskOptions; +import com.azure.resourcemanager.compute.models.DiffDiskPlacement; +import com.azure.resourcemanager.compute.models.DiffDiskSettings; +import com.azure.resourcemanager.compute.models.DiskCreateOptionTypes; +import com.azure.resourcemanager.compute.models.DiskEncryptionSetParameters; +import com.azure.resourcemanager.compute.models.ImageReference; +import com.azure.resourcemanager.compute.models.IpVersion; +import com.azure.resourcemanager.compute.models.LinuxConfiguration; +import com.azure.resourcemanager.compute.models.Plan; +import com.azure.resourcemanager.compute.models.ScaleInPolicy; +import com.azure.resourcemanager.compute.models.ScheduledEventsProfile; +import com.azure.resourcemanager.compute.models.SecurityProfile; +import com.azure.resourcemanager.compute.models.SecurityTypes; +import com.azure.resourcemanager.compute.models.Sku; +import com.azure.resourcemanager.compute.models.SpotRestorePolicy; +import com.azure.resourcemanager.compute.models.SshConfiguration; +import com.azure.resourcemanager.compute.models.SshPublicKey; +import com.azure.resourcemanager.compute.models.StorageAccountTypes; +import com.azure.resourcemanager.compute.models.TerminateNotificationProfile; +import com.azure.resourcemanager.compute.models.UefiSettings; +import com.azure.resourcemanager.compute.models.UpgradeMode; +import com.azure.resourcemanager.compute.models.UpgradePolicy; +import com.azure.resourcemanager.compute.models.VMGalleryApplication; +import com.azure.resourcemanager.compute.models.VirtualHardDisk; +import com.azure.resourcemanager.compute.models.VirtualMachineEvictionPolicyTypes; +import com.azure.resourcemanager.compute.models.VirtualMachinePriorityTypes; +import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetDataDisk; +import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetExtensionProfile; +import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetIpConfiguration; +import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetManagedDiskParameters; +import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetNetworkConfiguration; +import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetNetworkProfile; +import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetOSDisk; +import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetOSProfile; +import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetPublicIpAddressConfiguration; +import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetScaleInRules; +import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetStorageProfile; +import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetVMProfile; +import java.io.IOException; +import java.util.Arrays; + +/** Samples for VirtualMachineScaleSets CreateOrUpdate. */ +public final class VirtualMachineScaleSetsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetWithEmptyDataDisksOnEachVm.json + */ + /** + * Sample code: Create a scale set with empty data disks on each vm. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithEmptyDataDisksOnEachVm(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D2_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiskSizeGB(512) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS))) + .withDataDisks( + Arrays + .asList( + new VirtualMachineScaleSetDataDisk() + .withLun(0) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023), + new VirtualMachineScaleSetDataDisk() + .withLun(1) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateOrUpdateAScaleSetWithUserData.json + */ + /** + * Sample code: Create a scale set with userData. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithUserData(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withUserData("RXhhbXBsZSBVc2VyRGF0YQ==")) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetFromWithFpgaNetworkInterface.json + */ + /** + * Sample code: Create a scale set with Fpga Network Interfaces. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithFpgaNetworkInterfaces(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true), + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{fpgaNic-Name}") + .withPrimary(false) + .withEnableAcceleratedNetworking(false) + .withEnableFpga(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{fpgaNic-Name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-fpga-subnet-name}")) + .withPrimary(true) + .withPrivateIpAddressVersion(IpVersion.IPV4))) + .withEnableIpForwarding(false))))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetFromACustomImage.json + */ + /** + * Sample code: Create a scale set from a custom image. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetFromACustomImage(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetWithDiffOsDiskUsingDiffDiskPlacement.json + */ + /** + * Sample code: Create a scale set with ephemeral os disks using placement property. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithEphemeralOsDisksUsingPlacementProperty( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_DS1_v2").withTier("Standard").withCapacity(3L)) + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiffDiskSettings( + new DiffDiskSettings() + .withOption(DiffDiskOptions.LOCAL) + .withPlacement(DiffDiskPlacement.RESOURCE_DISK)) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetWithScaleInPolicy.json + */ + /** + * Sample code: Create a scale set with scaleInPolicy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithScaleInPolicy(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true) + .withScaleInPolicy( + new ScaleInPolicy() + .withRules(Arrays.asList(VirtualMachineScaleSetScaleInRules.OLDEST_VM)) + .withForceDeletion(true)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetWithEncryptionAtHost.json + */ + /** + * Sample code: Create a scale set with Host Encryption using encryptionAtHost property. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithHostEncryptionUsingEncryptionAtHostProperty( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_DS1_v2").withTier("Standard").withCapacity(3L)) + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withSecurityProfile(new SecurityProfile().withEncryptionAtHost(true))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetWithAnAzureLoadBalancer.json + */ + /** + * Sample code: Create a scale set with an azure load balancer. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithAnAzureLoadBalancer(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")) + .withPublicIpAddressConfiguration( + new VirtualMachineScaleSetPublicIpAddressConfiguration() + .withName("{vmss-name}") + .withPublicIpAddressVersion(IpVersion.IPV4)) + .withLoadBalancerBackendAddressPools( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/backendAddressPools/{existing-backend-address-pool-name}"))) + .withLoadBalancerInboundNatPools( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/inboundNatPools/{existing-nat-pool-name}"))))) + .withEnableIpForwarding(true))))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetWithManagedBootDiagnostics.json + */ + /** + * Sample code: Create a scale set with managed boot diagnostics. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithManagedBootDiagnostics(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile().withBootDiagnostics(new BootDiagnostics().withEnabled(true)))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetWithAMarketplaceImagePlan.json + */ + /** + * Sample code: Create a scale set with a marketplace image plan. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithAMarketplaceImagePlan(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetWithDiffOsDisk.json + */ + /** + * Sample code: Create a scale set with ephemeral os disks. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithEphemeralOsDisks(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_DS1_v2").withTier("Standard").withCapacity(3L)) + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiffDiskSettings( + new DiffDiskSettings().withOption(DiffDiskOptions.LOCAL)) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetWithVMsInDifferentZones.json + */ + /** + * Sample code: Create a scale set with virtual machines in different zones. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithVirtualMachinesInDifferentZones( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("centralus") + .withSku(new Sku().withName("Standard_A1_v2").withTier("Standard").withCapacity(2L)) + .withZones(Arrays.asList("1", "3")) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.AUTOMATIC)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withDiskSizeGB(512) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS))) + .withDataDisks( + Arrays + .asList( + new VirtualMachineScaleSetDataDisk() + .withLun(0) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023), + new VirtualMachineScaleSetDataDisk() + .withLun(1) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateOrUpdateAScaleSetWithCapacityReservation.json + */ + /** + * Sample code: Create or update a scale set with capacity reservation. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateAScaleSetWithCapacityReservation( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_DS1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withCapacityReservation( + new CapacityReservationProfile() + .withCapacityReservationGroup( + new SubResource() + .withId( + "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/{crgName}")))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetWithSshAuthentication.json + */ + /** + * Sample code: Create a scale set with ssh authentication. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithSshAuthentication(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withLinuxConfiguration( + new LinuxConfiguration() + .withDisablePasswordAuthentication(true) + .withSsh( + new SshConfiguration() + .withPublicKeys( + Arrays + .asList( + new SshPublicKey() + .withPath( + "/home/{your-username}/.ssh/authorized_keys") + .withKeyData( + "ssh-rsa" + + " AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1")))))) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetWithAnAzureApplicationGateway.json + */ + /** + * Sample code: Create a scale set with an azure application gateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithAnAzureApplicationGateway( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")) + .withApplicationGatewayBackendAddressPools( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/applicationGateways/{existing-application-gateway-name}/backendAddressPools/{existing-backend-address-pool-name}"))))) + .withEnableIpForwarding(true))))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateACustomImageScaleSetFromAnUnmanagedGeneralizedOsImage.json + */ + /** + * Sample code: Create a custom-image scale set from an unmanaged generalized os image. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createACustomImageScaleSetFromAnUnmanagedGeneralizedOsImage( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withName("osDisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withImage( + new VirtualHardDisk() + .withUri( + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd")))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetWithExtensionsTimeBudget.json + */ + /** + * Sample code: Create a scale set with extension time budget. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithExtensionTimeBudget(com.azure.resourcemanager.AzureResourceManager azure) + throws IOException { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri( + "http://{existing-storage-account-name}.blob.core.windows.net"))) + .withExtensionProfile( + new VirtualMachineScaleSetExtensionProfile() + .withExtensions( + Arrays + .asList( + new VirtualMachineScaleSetExtensionInner() + .withName("{extension-name}") + .withPublisher("{extension-Publisher}") + .withTypePropertiesType("{extension-Type}") + .withTypeHandlerVersion("{handler-version}") + .withAutoUpgradeMinorVersion(false) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)))) + .withExtensionsTimeBudget("PT1H20M"))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetWithApplicationProfile.json + */ + /** + * Sample code: Create a scale set with Application Profile. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithApplicationProfile(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withApplicationProfile( + new ApplicationProfile() + .withGalleryApplications( + Arrays + .asList( + new VMGalleryApplication() + .withTags("myTag1") + .withOrder(1) + .withPackageReferenceId( + "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0") + .withConfigurationReference( + "https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), + new VMGalleryApplication() + .withPackageReferenceId( + "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1"))))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScalesetWithDiskEncryptionSetResource.json + */ + /** + * Sample code: Create a scale set with DiskEncryptionSet resource in os disk and data disk. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithDiskEncryptionSetResourceInOsDiskAndDataDisk( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_DS1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")))) + .withDataDisks( + Arrays + .asList( + new VirtualMachineScaleSetDataDisk() + .withLun(0) + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")))))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetWithPremiumStorage.json + */ + /** + * Sample code: Create a scale set with premium storage. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithPremiumStorage(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetWithTerminateScheduledEventEnabled.json + */ + /** + * Sample code: Create a scale set with terminate scheduled events enabled. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithTerminateScheduledEventsEnabled( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withScheduledEventsProfile( + new ScheduledEventsProfile() + .withTerminateNotificationProfile( + new TerminateNotificationProfile() + .withNotBeforeTimeout("PT5M") + .withEnable(true)))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetWithExtensionsSuppressFailuresEnabled.json + */ + /** + * Sample code: Create a VMSS with an extension that has suppressFailures enabled. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVMSSWithAnExtensionThatHasSuppressFailuresEnabled( + com.azure.resourcemanager.AzureResourceManager azure) throws IOException { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri( + "http://{existing-storage-account-name}.blob.core.windows.net"))) + .withExtensionProfile( + new VirtualMachineScaleSetExtensionProfile() + .withExtensions( + Arrays + .asList( + new VirtualMachineScaleSetExtensionInner() + .withName("{extension-name}") + .withPublisher("{extension-Publisher}") + .withTypePropertiesType("{extension-Type}") + .withTypeHandlerVersion("{handler-version}") + .withAutoUpgradeMinorVersion(false) + .withSettings( + SerializerFactory + .createDefaultManagementSerializerAdapter() + .deserialize("{}", Object.class, SerializerEncoding.JSON)) + .withSuppressFailures(true))))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAPlatformImageScaleSetWithUnmanagedOsDisks.json + */ + /** + * Sample code: Create a platform-image scale set with unmanaged os disks. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAPlatformImageScaleSetWithUnmanagedOsDisks( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withName("osDisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withVhdContainers( + Arrays + .asList( + "http://{existing-storage-account-name-0}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-1}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-2}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-3}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-4}.blob.core.windows.net/vhdContainer")))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetWithUefiSettings.json + */ + /** + * Sample code: Create a scale set with Uefi Settings of secureBoot and vTPM. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithUefiSettingsOfSecureBootAndVTPM( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D2s_v3").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("windowsserver-gen2preview-preview") + .withSku("windows10-tvm") + .withVersion("18363.592.2001092016")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_SSD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withSecurityProfile( + new SecurityProfile() + .withUefiSettings( + new UefiSettings().withSecureBootEnabled(true).withVTpmEnabled(true)) + .withSecurityType(SecurityTypes.TRUSTED_LAUNCH))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetWithPasswordAuthentication.json + */ + /** + * Sample code: Create a scale set with password authentication. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithPasswordAuthentication(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetWithAutomaticRepairs.json + */ + /** + * Sample code: Create a scale set with automatic repairs enabled. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithAutomaticRepairsEnabled( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withAutomaticRepairsPolicy(new AutomaticRepairsPolicy().withEnabled(true).withGracePeriod("PT30M")) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetWithSpotRestorePolicy.json + */ + /** + * Sample code: Create a scale set with spot restore policy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithSpotRestorePolicy(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_A8m_v2").withTier("Standard").withCapacity(2L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withPriority(VirtualMachinePriorityTypes.SPOT) + .withEvictionPolicy(VirtualMachineEvictionPolicyTypes.DEALLOCATE) + .withBillingProfile(new BillingProfile().withMaxPrice(-1.0))) + .withOverprovision(true) + .withSpotRestorePolicy(new SpotRestorePolicy().withEnabled(true).withRestoreTimeout("PT1H")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetFromAGeneralizedSharedImage.json + */ + /** + * Sample code: Create a scale set from a generalized shared image. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetFromAGeneralizedSharedImage( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetWithBootDiagnostics.json + */ + /** + * Sample code: Create a scale set with boot diagnostics. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetWithBootDiagnostics(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withOsProfile( + new VirtualMachineScaleSetOSProfile() + .withComputerNamePrefix("{vmss-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri( + "http://{existing-storage-account-name}.blob.core.windows.net")))) + .withOverprovision(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAScaleSetFromASpecializedSharedImage.json + */ + /** + * Sample code: Create a scale set from a specialized shared image. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAScaleSetFromASpecializedSharedImage( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .createOrUpdate( + "myResourceGroup", + "{vmss-name}", + new VirtualMachineScaleSetInner() + .withLocation("westus") + .withSku(new Sku().withName("Standard_D1_v2").withTier("Standard").withCapacity(3L)) + .withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.MANUAL)) + .withVirtualMachineProfile( + new VirtualMachineScaleSetVMProfile() + .withStorageProfile( + new VirtualMachineScaleSetStorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage")) + .withOsDisk( + new VirtualMachineScaleSetOSDisk() + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new VirtualMachineScaleSetManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new VirtualMachineScaleSetNetworkProfile() + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetNetworkConfiguration() + .withName("{vmss-name}") + .withPrimary(true) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineScaleSetIpConfiguration() + .withName("{vmss-name}") + .withSubnet( + new ApiEntityReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}")))) + .withEnableIpForwarding(true))))) + .withOverprovision(true), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetsDeleteSamples.java new file mode 100644 index 0000000000000..66f14f506608f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSets Delete. */ +public final class VirtualMachineScaleSetsDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/ForceDeleteVirtualMachineScaleSets.json + */ + /** + * Sample code: Force Delete a VM scale set. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void forceDeleteAVMScaleSet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .delete("myResourceGroup", "myvmScaleSet", true, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..157034491063d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetsGetByResourceGroupSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSets GetByResourceGroup. */ +public final class VirtualMachineScaleSetsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GetVirtualMachineScaleSetAutoPlacedOnDedicatedHostGroup.json + */ + /** + * Sample code: Get a virtual machine scale set placed on a dedicated host group through automatic placement. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAVirtualMachineScaleSetPlacedOnADedicatedHostGroupThroughAutomaticPlacement( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .getByResourceGroupWithResponse("myResourceGroup", "myVirtualMachineScaleSet", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GetVirtualMachineScaleSetWithUserData.json + */ + /** + * Sample code: Get a virtual machine scale set with UserData. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAVirtualMachineScaleSetWithUserData(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .getByResourceGroupWithResponse("myResourceGroup", "myVirtualMachineScaleSet", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetsListByLocationSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetsListByLocationSamples.java new file mode 100644 index 0000000000000..47db08f8c7de4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachineScaleSetsListByLocationSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachineScaleSets ListByLocation. */ +public final class VirtualMachineScaleSetsListByLocationSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/ListVirtualMachineScaleSetsInASubscriptionByLocation.json + */ + /** + * Sample code: Lists all the VM scale sets under the specified subscription for the specified location. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listsAllTheVMScaleSetsUnderTheSpecifiedSubscriptionForTheSpecifiedLocation( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachineScaleSets() + .listByLocation("eastus", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesAssessPatchesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesAssessPatchesSamples.java new file mode 100644 index 0000000000000..92a79ca283074 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesAssessPatchesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines AssessPatches. */ +public final class VirtualMachinesAssessPatchesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/VirtualMachineAssessPatches.json + */ + /** + * Sample code: Assess patch state of a virtual machine. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void assessPatchStateOfAVirtualMachine(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .assessPatches("myResourceGroupName", "myVMName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..3389ed8f6255b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesCreateOrUpdateSamples.java @@ -0,0 +1,2297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.VirtualMachineInner; +import com.azure.resourcemanager.compute.models.AdditionalCapabilities; +import com.azure.resourcemanager.compute.models.ApplicationProfile; +import com.azure.resourcemanager.compute.models.BootDiagnostics; +import com.azure.resourcemanager.compute.models.CachingTypes; +import com.azure.resourcemanager.compute.models.CapacityReservationProfile; +import com.azure.resourcemanager.compute.models.DataDisk; +import com.azure.resourcemanager.compute.models.DeleteOptions; +import com.azure.resourcemanager.compute.models.DiagnosticsProfile; +import com.azure.resourcemanager.compute.models.DiffDiskOptions; +import com.azure.resourcemanager.compute.models.DiffDiskPlacement; +import com.azure.resourcemanager.compute.models.DiffDiskSettings; +import com.azure.resourcemanager.compute.models.DiskCreateOptionTypes; +import com.azure.resourcemanager.compute.models.DiskEncryptionSetParameters; +import com.azure.resourcemanager.compute.models.HardwareProfile; +import com.azure.resourcemanager.compute.models.ImageReference; +import com.azure.resourcemanager.compute.models.LinuxConfiguration; +import com.azure.resourcemanager.compute.models.LinuxPatchAssessmentMode; +import com.azure.resourcemanager.compute.models.LinuxPatchSettings; +import com.azure.resourcemanager.compute.models.LinuxVMGuestPatchMode; +import com.azure.resourcemanager.compute.models.ManagedDiskParameters; +import com.azure.resourcemanager.compute.models.NetworkApiVersion; +import com.azure.resourcemanager.compute.models.NetworkInterfaceReference; +import com.azure.resourcemanager.compute.models.NetworkProfile; +import com.azure.resourcemanager.compute.models.OSDisk; +import com.azure.resourcemanager.compute.models.OSProfile; +import com.azure.resourcemanager.compute.models.OperatingSystemTypes; +import com.azure.resourcemanager.compute.models.PatchSettings; +import com.azure.resourcemanager.compute.models.Plan; +import com.azure.resourcemanager.compute.models.PublicIpAddressSku; +import com.azure.resourcemanager.compute.models.PublicIpAddressSkuName; +import com.azure.resourcemanager.compute.models.PublicIpAddressSkuTier; +import com.azure.resourcemanager.compute.models.PublicIpAllocationMethod; +import com.azure.resourcemanager.compute.models.ScheduledEventsProfile; +import com.azure.resourcemanager.compute.models.SecurityProfile; +import com.azure.resourcemanager.compute.models.SecurityTypes; +import com.azure.resourcemanager.compute.models.SshConfiguration; +import com.azure.resourcemanager.compute.models.SshPublicKey; +import com.azure.resourcemanager.compute.models.StorageAccountTypes; +import com.azure.resourcemanager.compute.models.StorageProfile; +import com.azure.resourcemanager.compute.models.TerminateNotificationProfile; +import com.azure.resourcemanager.compute.models.UefiSettings; +import com.azure.resourcemanager.compute.models.VMGalleryApplication; +import com.azure.resourcemanager.compute.models.VMSizeProperties; +import com.azure.resourcemanager.compute.models.VirtualHardDisk; +import com.azure.resourcemanager.compute.models.VirtualMachineNetworkInterfaceConfiguration; +import com.azure.resourcemanager.compute.models.VirtualMachineNetworkInterfaceIpConfiguration; +import com.azure.resourcemanager.compute.models.VirtualMachinePublicIpAddressConfiguration; +import com.azure.resourcemanager.compute.models.VirtualMachineSizeTypes; +import com.azure.resourcemanager.compute.models.WindowsConfiguration; +import com.azure.resourcemanager.compute.models.WindowsPatchAssessmentMode; +import com.azure.resourcemanager.compute.models.WindowsVMGuestPatchMode; +import java.util.Arrays; + +/** Samples for VirtualMachines CreateOrUpdate. */ +public final class VirtualMachinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmFromASharedGalleryImage.json + */ + /** + * Sample code: Create a VM from a shared gallery image. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVMFromASharedGalleryImage(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withSharedGalleryImageId( + "/SharedGalleries/sharedGalleryName/Images/sharedGalleryImageName/Versions/sharedGalleryImageVersionName")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateOrUpdateAVmWithVMSizeProperties.json + */ + /** + * Sample code: Create a VM with VM Size Properties. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVMWithVMSizeProperties(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile( + new HardwareProfile() + .withVmSize(VirtualMachineSizeTypes.STANDARD_D4_V3) + .withVmSizeProperties(new VMSizeProperties().withVCpusAvailable(1).withVCpusPerCore(1))) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .withUserData("U29tZSBDdXN0b20gRGF0YQ=="), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAPlatformImageVmWithUnmanagedOsAndDataDisks.json + */ + /** + * Sample code: Create a platform-image vm with unmanaged os and data disks. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAPlatformImageVmWithUnmanagedOsAndDataDisks( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "{vm-name}", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withVhd( + new VirtualHardDisk() + .withUri( + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd")) + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE)) + .withDataDisks( + Arrays + .asList( + new DataDisk() + .withLun(0) + .withVhd( + new VirtualHardDisk() + .withUri( + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk0.vhd")) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023), + new DataDisk() + .withLun(1) + .withVhd( + new VirtualHardDisk() + .withUri( + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk1.vhd")) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateALinuxVmWithPatchSettingModesOfAutomaticByPlatform.json + */ + /** + * Sample code: Create a Linux vm with a patch settings patchMode and assessmentMode set to AutomaticByPlatform. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createALinuxVmWithAPatchSettingsPatchModeAndAssessmentModeSetToAutomaticByPlatform( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2S_V3)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("Canonical") + .withOffer("UbuntuServer") + .withSku("16.04-LTS") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withLinuxConfiguration( + new LinuxConfiguration() + .withProvisionVMAgent(true) + .withPatchSettings( + new LinuxPatchSettings() + .withPatchMode(LinuxVMGuestPatchMode.AUTOMATIC_BY_PLATFORM) + .withAssessmentMode(LinuxPatchAssessmentMode.AUTOMATIC_BY_PLATFORM)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmWithADiffOsDiskUsingDiffDiskPlacementAsCacheDisk.json + */ + /** + * Sample code: Create a vm with ephemeral os disk provisioning in Cache disk using placement property. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVmWithEphemeralOsDiskProvisioningInCacheDiskUsingPlacementProperty( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_DS1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withDiffDiskSettings( + new DiffDiskSettings() + .withOption(DiffDiskOptions.LOCAL) + .withPlacement(DiffDiskPlacement.CACHE_DISK)) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmWithAMarketplaceImagePlan.json + */ + /** + * Sample code: Create a vm with a marketplace image plan. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVmWithAMarketplaceImagePlan(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAWindowsVmWithPatchSettingModeOfAutomaticByOS.json + */ + /** + * Sample code: Create a Windows vm with a patch setting patchMode of AutomaticByOS. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAWindowsVmWithAPatchSettingPatchModeOfAutomaticByOS( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withWindowsConfiguration( + new WindowsConfiguration() + .withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withPatchSettings( + new PatchSettings().withPatchMode(WindowsVMGuestPatchMode.AUTOMATIC_BY_OS)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAWindowsVmWithPatchSettingModesOfAutomaticByPlatform.json + */ + /** + * Sample code: Create a Windows vm with patch settings patchMode and assessmentMode set to AutomaticByPlatform. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAWindowsVmWithPatchSettingsPatchModeAndAssessmentModeSetToAutomaticByPlatform( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withWindowsConfiguration( + new WindowsConfiguration() + .withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withPatchSettings( + new PatchSettings() + .withPatchMode(WindowsVMGuestPatchMode.AUTOMATIC_BY_PLATFORM) + .withAssessmentMode(WindowsPatchAssessmentMode.AUTOMATIC_BY_PLATFORM)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAWindowsVmWithPatchSettingAssessmentModeOfImageDefault.json + */ + /** + * Sample code: Create a Windows vm with a patch setting assessmentMode of ImageDefault. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAWindowsVmWithAPatchSettingAssessmentModeOfImageDefault( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withWindowsConfiguration( + new WindowsConfiguration() + .withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withPatchSettings( + new PatchSettings() + .withAssessmentMode(WindowsPatchAssessmentMode.IMAGE_DEFAULT)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmWithPremiumStorage.json + */ + /** + * Sample code: Create a vm with premium storage. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVmWithPremiumStorage(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateOrUpdateAVmWithCapacityReservation.json + */ + /** + * Sample code: Create or update a VM with capacity reservation. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateAVMWithCapacityReservation(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_DS1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withCapacityReservation( + new CapacityReservationProfile() + .withCapacityReservationGroup( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/{crgName}"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateALinuxVmWithPatchSettingAssessmentModeOfImageDefault.json + */ + /** + * Sample code: Create a Linux vm with a patch setting assessmentMode of ImageDefault. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createALinuxVmWithAPatchSettingAssessmentModeOfImageDefault( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2S_V3)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("Canonical") + .withOffer("UbuntuServer") + .withSku("16.04-LTS") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withLinuxConfiguration( + new LinuxConfiguration() + .withProvisionVMAgent(true) + .withPatchSettings( + new LinuxPatchSettings() + .withAssessmentMode(LinuxPatchAssessmentMode.IMAGE_DEFAULT)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAWindowsVmWithPatchSettingModeOfAutomaticByPlatformAndEnableHotPatchingTrue.json + */ + /** + * Sample code: Create a Windows vm with a patch setting patchMode of AutomaticByPlatform and enableHotpatching set + * to true. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAWindowsVmWithAPatchSettingPatchModeOfAutomaticByPlatformAndEnableHotpatchingSetToTrue( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withWindowsConfiguration( + new WindowsConfiguration() + .withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withPatchSettings( + new PatchSettings() + .withPatchMode(WindowsVMGuestPatchMode.AUTOMATIC_BY_PLATFORM) + .withEnableHotpatching(true)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmWithExtensionsTimeBudget.json + */ + /** + * Sample code: Create a vm with an extensions time budget. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVmWithAnExtensionsTimeBudget(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .withExtensionsTimeBudget("PT30M"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateACustomImageVmFromAnUnmanagedGeneralizedOsImage.json + */ + /** + * Sample code: Create a custom-image vm from an unmanaged generalized os image. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createACustomImageVmFromAnUnmanagedGeneralizedOsImage( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "{vm-name}", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withOsDisk( + new OSDisk() + .withOsType(OperatingSystemTypes.WINDOWS) + .withName("myVMosdisk") + .withVhd( + new VirtualHardDisk() + .withUri( + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd")) + .withImage( + new VirtualHardDisk() + .withUri( + "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd")) + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmWithEncryptionAtHost.json + */ + /** + * Sample code: Create a vm with Host Encryption using encryptionAtHost property. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVmWithHostEncryptionUsingEncryptionAtHostProperty( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_DS1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withSecurityProfile(new SecurityProfile().withEncryptionAtHost(true)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmInAnAvailabilitySet.json + */ + /** + * Sample code: Create a vm in an availability set. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVmInAnAvailabilitySet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withAvailabilitySet( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/{existing-availability-set-name}")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmWithEmptyDataDisks.json + */ + /** + * Sample code: Create a vm with empty data disks. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVmWithEmptyDataDisks(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS))) + .withDataDisks( + Arrays + .asList( + new DataDisk() + .withLun(0) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023), + new DataDisk() + .withLun(1) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmWithNetworkInterfaceConfiguration.json + */ + /** + * Sample code: Create a VM with network interface configuration. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVMWithNetworkInterfaceConfiguration( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkApiVersion(NetworkApiVersion.TWO_ZERO_TWO_ZERO_ONE_ONE_ZERO_ONE) + .withNetworkInterfaceConfigurations( + Arrays + .asList( + new VirtualMachineNetworkInterfaceConfiguration() + .withName("{nic-config-name}") + .withPrimary(true) + .withDeleteOption(DeleteOptions.DELETE) + .withIpConfigurations( + Arrays + .asList( + new VirtualMachineNetworkInterfaceIpConfiguration() + .withName("{ip-config-name}") + .withPrimary(true) + .withPublicIpAddressConfiguration( + new VirtualMachinePublicIpAddressConfiguration() + .withName("{publicIP-config-name}") + .withSku( + new PublicIpAddressSku() + .withName(PublicIpAddressSkuName.BASIC) + .withTier(PublicIpAddressSkuTier.GLOBAL)) + .withDeleteOption(DeleteOptions.DETACH) + .withPublicIpAllocationMethod( + PublicIpAllocationMethod.STATIC))))))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmFromACustomImage.json + */ + /** + * Sample code: Create a vm from a custom image. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVmFromACustomImage(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateOrUpdateAVmWithHibernationEnabled.json + */ + /** + * Sample code: Create a VM with HibernationEnabled. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVMWithHibernationEnabled(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "{vm-name}", + new VirtualMachineInner() + .withLocation("eastus2euap") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2S_V3)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2019-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("vmOSdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withAdditionalCapabilities(new AdditionalCapabilities().withHibernationEnabled(true)) + .withOsProfile( + new OSProfile() + .withComputerName("{vm-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmWithUefiSettings.json + */ + /** + * Sample code: Create a VM with Uefi Settings of secureBoot and vTPM. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVMWithUefiSettingsOfSecureBootAndVTPM( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2S_V3)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("windowsserver-gen2preview-preview") + .withSku("windows10-tvm") + .withVersion("18363.592.2001092016")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_SSD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withSecurityProfile( + new SecurityProfile() + .withUefiSettings(new UefiSettings().withSecureBootEnabled(true).withVTpmEnabled(true)) + .withSecurityType(SecurityTypes.TRUSTED_LAUNCH)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmWithApplicationProfile.json + */ + /** + * Sample code: Create a vm with Application Profile. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVmWithApplicationProfile(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("{image_publisher}") + .withOffer("{image_offer}") + .withSku("{image_sku}") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withApplicationProfile( + new ApplicationProfile() + .withGalleryApplications( + Arrays + .asList( + new VMGalleryApplication() + .withTags("myTag1") + .withOrder(1) + .withPackageReferenceId( + "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0") + .withConfigurationReference( + "https://mystorageaccount.blob.core.windows.net/configurations/settings.config"), + new VMGalleryApplication() + .withPackageReferenceId( + "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1")))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmFromASpecializedSharedImage.json + */ + /** + * Sample code: Create a vm from a specialized shared image. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVmFromASpecializedSharedImage(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmWithPasswordAuthentication.json + */ + /** + * Sample code: Create a vm with password authentication. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVmWithPasswordAuthentication(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmInAVirtualMachineScaleSetWithCustomerAssignedPlatformFaultDomain.json + */ + /** + * Sample code: Create a vm in a Virtual Machine Scale Set with customer assigned platformFaultDomain. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVmInAVirtualMachineScaleSetWithCustomerAssignedPlatformFaultDomain( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withVirtualMachineScaleSet( + new SubResource() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{existing-flex-vmss-name-with-platformFaultDomainCount-greater-than-1}")) + .withPlatformFaultDomain(1), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmWithScheduledEventsProfile.json + */ + /** + * Sample code: Create a vm with Scheduled Events Profile. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVmWithScheduledEventsProfile(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .withScheduledEventsProfile( + new ScheduledEventsProfile() + .withTerminateNotificationProfile( + new TerminateNotificationProfile().withNotBeforeTimeout("PT10M").withEnable(true))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmWithBootDiagnostics.json + */ + /** + * Sample code: Create a vm with boot diagnostics. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVmWithBootDiagnostics(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmWithSshAuthentication.json + */ + /** + * Sample code: Create a vm with ssh authentication. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVmWithSshAuthentication(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("{image_publisher}") + .withOffer("{image_offer}") + .withSku("{image_sku}") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withLinuxConfiguration( + new LinuxConfiguration() + .withDisablePasswordAuthentication(true) + .withSsh( + new SshConfiguration() + .withPublicKeys( + Arrays + .asList( + new SshPublicKey() + .withPath("/home/{your-username}/.ssh/authorized_keys") + .withKeyData( + "ssh-rsa" + + " AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1")))))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmWithADiffOsDiskUsingDiffDiskPlacementAsResourceDisk.json + */ + /** + * Sample code: Create a vm with ephemeral os disk provisioning in Resource disk using placement property. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVmWithEphemeralOsDiskProvisioningInResourceDiskUsingPlacementProperty( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_DS1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withDiffDiskSettings( + new DiffDiskSettings() + .withOption(DiffDiskOptions.LOCAL) + .withPlacement(DiffDiskPlacement.RESOURCE_DISK)) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmWithADiffOsDisk.json + */ + /** + * Sample code: Create a vm with ephemeral os disk. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVmWithEphemeralOsDisk(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withPlan( + new Plan() + .withName("windows2016") + .withPublisher("microsoft-ads") + .withProduct("windows-data-science-vm")) + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_DS1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("microsoft-ads") + .withOffer("windows-data-science-vm") + .withSku("windows2016") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_ONLY) + .withDiffDiskSettings(new DiffDiskSettings().withOption(DiffDiskOptions.LOCAL)) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateOrUpdateAVmWithUserData.json + */ + /** + * Sample code: Create a VM with UserData. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVMWithUserData(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "{vm-name}", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("vmOSdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("{vm-name}") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile() + .withBootDiagnostics( + new BootDiagnostics() + .withEnabled(true) + .withStorageUri("http://{existing-storage-account-name}.blob.core.windows.net"))) + .withUserData("RXhhbXBsZSBVc2VyRGF0YQ=="), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmFromAGeneralizedSharedImage.json + */ + /** + * Sample code: Create a vm from a generalized shared image. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVmFromAGeneralizedSharedImage(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAWindowsVmWithPatchSettingModeOfManual.json + */ + /** + * Sample code: Create a Windows vm with a patch setting patchMode of Manual. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAWindowsVmWithAPatchSettingPatchModeOfManual( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withWindowsConfiguration( + new WindowsConfiguration() + .withProvisionVMAgent(true) + .withEnableAutomaticUpdates(true) + .withPatchSettings( + new PatchSettings().withPatchMode(WindowsVMGuestPatchMode.MANUAL)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateALinuxVmWithPatchSettingModeOfImageDefault.json + */ + /** + * Sample code: Create a Linux vm with a patch setting patchMode of ImageDefault. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createALinuxVmWithAPatchSettingPatchModeOfImageDefault( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2S_V3)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("Canonical") + .withOffer("UbuntuServer") + .withSku("16.04-LTS") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.PREMIUM_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}") + .withLinuxConfiguration( + new LinuxConfiguration() + .withProvisionVMAgent(true) + .withPatchSettings( + new LinuxPatchSettings().withPatchMode(LinuxVMGuestPatchMode.IMAGE_DEFAULT)))) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmWithManagedBootDiagnostics.json + */ + /** + * Sample code: Create a vm with managed boot diagnostics. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVmWithManagedBootDiagnostics(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))) + .withDiagnosticsProfile( + new DiagnosticsProfile().withBootDiagnostics(new BootDiagnostics().withEnabled(true))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/CreateAVmWithDiskEncryptionSetResource.json + */ + /** + * Sample code: Create a vm with DiskEncryptionSet resource id in the os disk and data disk. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAVmWithDiskEncryptionSetResourceIdInTheOsDiskAndDataDisk( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .createOrUpdate( + "myResourceGroup", + "myVM", + new VirtualMachineInner() + .withLocation("westus") + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D1_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")))) + .withDataDisks( + Arrays + .asList( + new DataDisk() + .withLun(0) + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}"))), + new DataDisk() + .withLun(1) + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.ATTACH) + .withDiskSizeGB(1023) + .withManagedDisk( + new ManagedDiskParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/{existing-managed-disk-name}") + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS) + .withDiskEncryptionSet( + new DiskEncryptionSetParameters() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}")))))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesDeleteSamples.java new file mode 100644 index 0000000000000..fda4b82ea99e9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Delete. */ +public final class VirtualMachinesDeleteSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/ForceDeleteVirtualMachine.json + */ + /** + * Sample code: Force delete a VM. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void forceDeleteAVM(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .delete("myResourceGroup", "myVM", true, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesGeneralizeSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesGeneralizeSamples.java new file mode 100644 index 0000000000000..9ece1e79bf564 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesGeneralizeSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Generalize. */ +public final class VirtualMachinesGeneralizeSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GeneralizeVirtualMachine.json + */ + /** + * Sample code: Generalize a Virtual Machine. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void generalizeAVirtualMachine(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .generalizeWithResponse("myResourceGroup", "myVMName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..bcebfa8920768 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesGetByResourceGroupSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines GetByResourceGroup. */ +public final class VirtualMachinesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GetVirtualMachineAutoPlacedOnDedicatedHostGroup.json + */ + /** + * Sample code: Get a virtual machine placed on a dedicated host group through automatic placement. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .getByResourceGroupWithResponse("myResourceGroup", "myVM", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GetVirtualMachine.json + */ + /** + * Sample code: Get a Virtual Machine. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAVirtualMachine(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .getByResourceGroupWithResponse("myResourceGroup", "myVM", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesInstallPatchesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesInstallPatchesSamples.java new file mode 100644 index 0000000000000..a70c3d84d1b3d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesInstallPatchesSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.VMGuestPatchClassificationWindows; +import com.azure.resourcemanager.compute.models.VMGuestPatchRebootSetting; +import com.azure.resourcemanager.compute.models.VirtualMachineInstallPatchesParameters; +import com.azure.resourcemanager.compute.models.WindowsParameters; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for VirtualMachines InstallPatches. */ +public final class VirtualMachinesInstallPatchesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/VirtualMachineInstallPatches.json + */ + /** + * Sample code: Install patch state of a virtual machine. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void installPatchStateOfAVirtualMachine(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .installPatches( + "myResourceGroupName", + "myVMName", + new VirtualMachineInstallPatchesParameters() + .withMaximumDuration("PT4H") + .withRebootSetting(VMGuestPatchRebootSetting.IF_REQUIRED) + .withWindowsParameters( + new WindowsParameters() + .withClassificationsToInclude( + Arrays + .asList( + VMGuestPatchClassificationWindows.CRITICAL, + VMGuestPatchClassificationWindows.SECURITY)) + .withMaxPatchPublishDate(OffsetDateTime.parse("2020-11-19T02:36:43.0539904+00:00"))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesInstanceViewSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesInstanceViewSamples.java new file mode 100644 index 0000000000000..c2af0ec9266b3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesInstanceViewSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines InstanceView. */ +public final class VirtualMachinesInstanceViewSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GetVirtualMachineInstanceView.json + */ + /** + * Sample code: Get Virtual Machine Instance View. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualMachineInstanceView(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .instanceViewWithResponse("myResourceGroup", "myVM", Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/GetVirtualMachineInstanceViewAutoPlacedOnDedicatedHostGroup.json + */ + /** + * Sample code: Get instance view of a virtual machine placed on a dedicated host group through automatic placement. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getInstanceViewOfAVirtualMachinePlacedOnADedicatedHostGroupThroughAutomaticPlacement( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .instanceViewWithResponse("myResourceGroup", "myVM", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesListAvailableSizesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesListAvailableSizesSamples.java new file mode 100644 index 0000000000000..447fa59145610 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesListAvailableSizesSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines ListAvailableSizes. */ +public final class VirtualMachinesListAvailableSizesSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/ListAvailableVmSizes_VirtualMachines.json + */ + /** + * Sample code: Lists all available virtual machine sizes to which the specified virtual machine can be resized. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listsAllAvailableVirtualMachineSizesToWhichTheSpecifiedVirtualMachineCanBeResized( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .listAvailableSizes("myResourceGroup", "myVmName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesListByLocationSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesListByLocationSamples.java new file mode 100644 index 0000000000000..f9b0153b97004 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesListByLocationSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines ListByLocation. */ +public final class VirtualMachinesListByLocationSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/ListVirtualMachinesInASubscriptionByLocation.json + */ + /** + * Sample code: Lists all the virtual machines under the specified subscription for the specified location. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listsAllTheVirtualMachinesUnderTheSpecifiedSubscriptionForTheSpecifiedLocation( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.virtualMachines().manager().serviceClient().getVirtualMachines().listByLocation("eastus", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesReapplySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesReapplySamples.java new file mode 100644 index 0000000000000..7459e14a6f3ea --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesReapplySamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines Reapply. */ +public final class VirtualMachinesReapplySamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/ReapplyVirtualMachine.json + */ + /** + * Sample code: Reapply the state of a virtual machine. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void reapplyTheStateOfAVirtualMachine(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .reapply("ResourceGroup", "VMName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesReimageSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesReimageSamples.java new file mode 100644 index 0000000000000..51e561a279baf --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesReimageSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.VirtualMachineReimageParameters; + +/** Samples for VirtualMachines Reimage. */ +public final class VirtualMachinesReimageSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/ReimageVirtualMachine.json + */ + /** + * Sample code: Reimage a Virtual Machine. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void reimageAVirtualMachine(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .reimage( + "myResourceGroup", "myVMName", new VirtualMachineReimageParameters().withTempDisk(true), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesRetrieveBootDiagnosticsDataSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesRetrieveBootDiagnosticsDataSamples.java new file mode 100644 index 0000000000000..2170b779428b4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesRetrieveBootDiagnosticsDataSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines RetrieveBootDiagnosticsData. */ +public final class VirtualMachinesRetrieveBootDiagnosticsDataSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/RetrieveBootDiagnosticsDataVirtualMachine.json + */ + /** + * Sample code: RetrieveBootDiagnosticsData of a virtual machine. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void retrieveBootDiagnosticsDataOfAVirtualMachine( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .retrieveBootDiagnosticsDataWithResponse("ResourceGroup", "VMName", 60, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesRunCommandSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesRunCommandSamples.java new file mode 100644 index 0000000000000..90283b7803011 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesRunCommandSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.models.RunCommandInput; + +/** Samples for VirtualMachines RunCommand. */ +public final class VirtualMachinesRunCommandSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/runCommands/VirtualMachineRunCommand.json + */ + /** + * Sample code: VirtualMachineRunCommand. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualMachineRunCommand(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .runCommand( + "crptestar98131", "vm3036", new RunCommandInput().withCommandId("RunPowerShellScript"), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesSimulateEvictionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesSimulateEvictionSamples.java new file mode 100644 index 0000000000000..6b17c95007e86 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesSimulateEvictionSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualMachines SimulateEviction. */ +public final class VirtualMachinesSimulateEvictionSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/SimulateEvictionOfVM.json + */ + /** + * Sample code: Simulate Eviction a virtual machine. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void simulateEvictionAVirtualMachine(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .simulateEvictionWithResponse("ResourceGroup", "VMName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesUpdateSamples.java new file mode 100644 index 0000000000000..eae748cbb526a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/compute/generated/VirtualMachinesUpdateSamples.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.compute.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.compute.fluent.models.VirtualMachineUpdateInner; +import com.azure.resourcemanager.compute.models.CachingTypes; +import com.azure.resourcemanager.compute.models.DataDisk; +import com.azure.resourcemanager.compute.models.DiskCreateOptionTypes; +import com.azure.resourcemanager.compute.models.DiskDetachOptionTypes; +import com.azure.resourcemanager.compute.models.HardwareProfile; +import com.azure.resourcemanager.compute.models.ImageReference; +import com.azure.resourcemanager.compute.models.ManagedDiskParameters; +import com.azure.resourcemanager.compute.models.NetworkInterfaceReference; +import com.azure.resourcemanager.compute.models.NetworkProfile; +import com.azure.resourcemanager.compute.models.OSDisk; +import com.azure.resourcemanager.compute.models.OSProfile; +import com.azure.resourcemanager.compute.models.StorageAccountTypes; +import com.azure.resourcemanager.compute.models.StorageProfile; +import com.azure.resourcemanager.compute.models.VirtualMachineSizeTypes; +import java.util.Arrays; + +/** Samples for VirtualMachines Update. */ +public final class VirtualMachinesUpdateSamples { + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/UpdateVMDetachDataDiskUsingToBeDetachedProperty.json + */ + /** + * Sample code: Update a VM by detaching data disk. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateAVMByDetachingDataDisk(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .update( + "myResourceGroup", + "myVM", + new VirtualMachineUpdateInner() + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS))) + .withDataDisks( + Arrays + .asList( + new DataDisk() + .withLun(0) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023) + .withToBeDetached(true), + new DataDisk() + .withLun(1) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023) + .withToBeDetached(false)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-07-01/examples/compute/UpdateVMForceDetachDataDisk.json + */ + /** + * Sample code: Update a VM by force-detaching data disk. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateAVMByForceDetachingDataDisk(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .virtualMachines() + .manager() + .serviceClient() + .getVirtualMachines() + .update( + "myResourceGroup", + "myVM", + new VirtualMachineUpdateInner() + .withHardwareProfile(new HardwareProfile().withVmSize(VirtualMachineSizeTypes.STANDARD_D2_V2)) + .withStorageProfile( + new StorageProfile() + .withImageReference( + new ImageReference() + .withPublisher("MicrosoftWindowsServer") + .withOffer("WindowsServer") + .withSku("2016-Datacenter") + .withVersion("latest")) + .withOsDisk( + new OSDisk() + .withName("myVMosdisk") + .withCaching(CachingTypes.READ_WRITE) + .withCreateOption(DiskCreateOptionTypes.FROM_IMAGE) + .withManagedDisk( + new ManagedDiskParameters() + .withStorageAccountType(StorageAccountTypes.STANDARD_LRS))) + .withDataDisks( + Arrays + .asList( + new DataDisk() + .withLun(0) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023) + .withToBeDetached(true) + .withDetachOption(DiskDetachOptionTypes.FORCE_DETACH), + new DataDisk() + .withLun(1) + .withCreateOption(DiskCreateOptionTypes.EMPTY) + .withDiskSizeGB(1023) + .withToBeDetached(false)))) + .withOsProfile( + new OSProfile() + .withComputerName("myVM") + .withAdminUsername("{your-username}") + .withAdminPassword("{your-password}")) + .withNetworkProfile( + new NetworkProfile() + .withNetworkInterfaces( + Arrays + .asList( + new NetworkInterfaceReference() + .withId( + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}") + .withPrimary(true)))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/AgentPoolsCreateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/AgentPoolsCreateSamples.java new file mode 100644 index 0000000000000..c7e34fd209506 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/AgentPoolsCreateSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.fluent.models.AgentPoolInner; +import com.azure.resourcemanager.containerregistry.models.OS; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AgentPools Create. */ +public final class AgentPoolsCreateSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsCreate.json + */ + /** + * Sample code: AgentPools_Create. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void agentPoolsCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getAgentPools() + .create( + "myResourceGroup", + "myRegistry", + "myAgentPool", + new AgentPoolInner() + .withLocation("WESTUS") + .withTags(mapOf("key", "value")) + .withCount(1) + .withTier("S1") + .withOs(OS.LINUX), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/AgentPoolsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/AgentPoolsDeleteSamples.java new file mode 100644 index 0000000000000..d081c05e19c65 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/AgentPoolsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for AgentPools Delete. */ +public final class AgentPoolsDeleteSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsDelete.json + */ + /** + * Sample code: AgentPools_Delete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void agentPoolsDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getAgentPools() + .delete("myResourceGroup", "myRegistry", "myAgentPool", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/AgentPoolsGetQueueStatusSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/AgentPoolsGetQueueStatusSamples.java new file mode 100644 index 0000000000000..ac09950999df9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/AgentPoolsGetQueueStatusSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for AgentPools GetQueueStatus. */ +public final class AgentPoolsGetQueueStatusSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsGetQueueStatus.json + */ + /** + * Sample code: AgentPools_GetQueueStatus. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void agentPoolsGetQueueStatus(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getAgentPools() + .getQueueStatusWithResponse("myResourceGroup", "myRegistry", "myAgentPool", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/AgentPoolsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/AgentPoolsGetSamples.java new file mode 100644 index 0000000000000..92f5022dc1c4d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/AgentPoolsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for AgentPools Get. */ +public final class AgentPoolsGetSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsGet.json + */ + /** + * Sample code: AgentPools_Get. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void agentPoolsGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getAgentPools() + .getWithResponse("myResourceGroup", "myRegistry", "myAgentPool", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/AgentPoolsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/AgentPoolsListSamples.java new file mode 100644 index 0000000000000..b0ac9a476a4e2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/AgentPoolsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for AgentPools List. */ +public final class AgentPoolsListSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsList.json + */ + /** + * Sample code: AgentPools_List. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void agentPoolsList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getAgentPools() + .list("myResourceGroup", "myRegistry", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/AgentPoolsUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/AgentPoolsUpdateSamples.java new file mode 100644 index 0000000000000..bc7d612663ead --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/AgentPoolsUpdateSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.models.AgentPoolUpdateParameters; + +/** Samples for AgentPools Update. */ +public final class AgentPoolsUpdateSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/AgentPoolsUpdate.json + */ + /** + * Sample code: AgentPools_Update. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void agentPoolsUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getAgentPools() + .update( + "myResourceGroup", + "myRegistry", + "myAgentPool", + new AgentPoolUpdateParameters().withCount(1), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ExportPipelinesCreateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ExportPipelinesCreateSamples.java new file mode 100644 index 0000000000000..3861f41c28be9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ExportPipelinesCreateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.fluent.models.ExportPipelineInner; +import com.azure.resourcemanager.containerregistry.models.ExportPipelineTargetProperties; +import com.azure.resourcemanager.containerregistry.models.IdentityProperties; +import com.azure.resourcemanager.containerregistry.models.PipelineOptions; +import com.azure.resourcemanager.containerregistry.models.ResourceIdentityType; +import java.util.Arrays; + +/** Samples for ExportPipelines Create. */ +public final class ExportPipelinesCreateSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/ExportPipelineCreate.json + */ + /** + * Sample code: ExportPipelineCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void exportPipelineCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getExportPipelines() + .create( + "myResourceGroup", + "myRegistry", + "myExportPipeline", + new ExportPipelineInner() + .withLocation("westus") + .withIdentity(new IdentityProperties().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) + .withTarget( + new ExportPipelineTargetProperties() + .withType("AzureStorageBlobContainer") + .withUri("https://accountname.blob.core.windows.net/containername") + .withKeyVaultUri("https://myvault.vault.azure.net/secrets/acrexportsas")) + .withOptions(Arrays.asList(PipelineOptions.OVERWRITE_BLOBS)), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ExportPipelinesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ExportPipelinesDeleteSamples.java new file mode 100644 index 0000000000000..20d2760caaae3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ExportPipelinesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for ExportPipelines Delete. */ +public final class ExportPipelinesDeleteSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/ExportPipelineDelete.json + */ + /** + * Sample code: ExportPipelineDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void exportPipelineDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getExportPipelines() + .delete("myResourceGroup", "myRegistry", "myExportPipeline", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ExportPipelinesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ExportPipelinesGetSamples.java new file mode 100644 index 0000000000000..86d6e376697db --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ExportPipelinesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for ExportPipelines Get. */ +public final class ExportPipelinesGetSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/ExportPipelineGet.json + */ + /** + * Sample code: ExportPipelineGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void exportPipelineGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getExportPipelines() + .getWithResponse("myResourceGroup", "myRegistry", "myExportPipeline", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ExportPipelinesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ExportPipelinesListSamples.java new file mode 100644 index 0000000000000..6c46b8b18f903 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ExportPipelinesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for ExportPipelines List. */ +public final class ExportPipelinesListSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/ExportPipelineList.json + */ + /** + * Sample code: ExportPipelineList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void exportPipelineList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getExportPipelines() + .list("myResourceGroup", "myRegistry", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ImportPipelinesCreateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ImportPipelinesCreateSamples.java new file mode 100644 index 0000000000000..8e66efdc64b32 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ImportPipelinesCreateSamples.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.fluent.models.ImportPipelineInner; +import com.azure.resourcemanager.containerregistry.models.IdentityProperties; +import com.azure.resourcemanager.containerregistry.models.ImportPipelineSourceProperties; +import com.azure.resourcemanager.containerregistry.models.PipelineOptions; +import com.azure.resourcemanager.containerregistry.models.PipelineSourceType; +import com.azure.resourcemanager.containerregistry.models.ResourceIdentityType; +import com.azure.resourcemanager.containerregistry.models.UserIdentityProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ImportPipelines Create. */ +public final class ImportPipelinesCreateSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/ImportPipelineCreate.json + */ + /** + * Sample code: ImportPipelineCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void importPipelineCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getImportPipelines() + .create( + "myResourceGroup", + "myRegistry", + "myImportPipeline", + new ImportPipelineInner() + .withLocation("westus") + .withIdentity( + new IdentityProperties() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2", + new UserIdentityProperties()))) + .withSource( + new ImportPipelineSourceProperties() + .withType(PipelineSourceType.AZURE_STORAGE_BLOB_CONTAINER) + .withUri("https://accountname.blob.core.windows.net/containername") + .withKeyVaultUri("https://myvault.vault.azure.net/secrets/acrimportsas")) + .withOptions( + Arrays + .asList( + PipelineOptions.OVERWRITE_TAGS, + PipelineOptions.DELETE_SOURCE_BLOB_ON_SUCCESS, + PipelineOptions.CONTINUE_ON_ERRORS)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ImportPipelinesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ImportPipelinesDeleteSamples.java new file mode 100644 index 0000000000000..9b884495d051d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ImportPipelinesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for ImportPipelines Delete. */ +public final class ImportPipelinesDeleteSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/ImportPipelineDelete.json + */ + /** + * Sample code: ImportPipelineDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void importPipelineDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getImportPipelines() + .delete("myResourceGroup", "myRegistry", "myImportPipeline", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ImportPipelinesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ImportPipelinesGetSamples.java new file mode 100644 index 0000000000000..a0e10ff0fe0d0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ImportPipelinesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for ImportPipelines Get. */ +public final class ImportPipelinesGetSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/ImportPipelineGet.json + */ + /** + * Sample code: ImportPipelineGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void importPipelineGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getImportPipelines() + .getWithResponse("myResourceGroup", "myRegistry", "myImportPipeline", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ImportPipelinesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ImportPipelinesListSamples.java new file mode 100644 index 0000000000000..f2342e6b94a55 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ImportPipelinesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for ImportPipelines List. */ +public final class ImportPipelinesListSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/ImportPipelineList.json + */ + /** + * Sample code: ImportPipelineList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void importPipelineList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getImportPipelines() + .list("myResourceGroup", "myRegistry", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/OperationsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..56eaa81ee6ce4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/OperationList.json + */ + /** + * Sample code: OperationList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void operationList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.containerRegistries().manager().serviceClient().getOperations().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PipelineRunsCreateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PipelineRunsCreateSamples.java new file mode 100644 index 0000000000000..2279356bcfd1b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PipelineRunsCreateSamples.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.fluent.models.PipelineRunInner; +import com.azure.resourcemanager.containerregistry.models.PipelineRunRequest; +import com.azure.resourcemanager.containerregistry.models.PipelineRunSourceProperties; +import com.azure.resourcemanager.containerregistry.models.PipelineRunSourceType; +import com.azure.resourcemanager.containerregistry.models.PipelineRunTargetProperties; +import com.azure.resourcemanager.containerregistry.models.PipelineRunTargetType; +import java.util.Arrays; + +/** Samples for PipelineRuns Create. */ +public final class PipelineRunsCreateSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/PipelineRunCreate_Import.json + */ + /** + * Sample code: PipelineRunCreate_Import. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void pipelineRunCreateImport(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getPipelineRuns() + .create( + "myResourceGroup", + "myRegistry", + "myPipelineRun", + new PipelineRunInner() + .withRequest( + new PipelineRunRequest() + .withPipelineResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/importPipelines/myImportPipeline") + .withSource( + new PipelineRunSourceProperties() + .withType(PipelineRunSourceType.AZURE_STORAGE_BLOB) + .withName("myblob.tar.gz")) + .withCatalogDigest("sha256@")) + .withForceUpdateTag("2020-03-04T17:23:21.9261521+00:00"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/PipelineRunCreate_Export.json + */ + /** + * Sample code: PipelineRunCreate_Export. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void pipelineRunCreateExport(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getPipelineRuns() + .create( + "myResourceGroup", + "myRegistry", + "myPipelineRun", + new PipelineRunInner() + .withRequest( + new PipelineRunRequest() + .withPipelineResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/exportPipelines/myExportPipeline") + .withArtifacts( + Arrays + .asList( + "sourceRepository/hello-world", + "sourceRepository2@sha256:00000000000000000000000000000000000")) + .withTarget( + new PipelineRunTargetProperties() + .withType(PipelineRunTargetType.AZURE_STORAGE_BLOB) + .withName("myblob.tar.gz"))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PipelineRunsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PipelineRunsDeleteSamples.java new file mode 100644 index 0000000000000..eb919a07a120c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PipelineRunsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for PipelineRuns Delete. */ +public final class PipelineRunsDeleteSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/PipelineRunDelete.json + */ + /** + * Sample code: PipelineRunDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void pipelineRunDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getPipelineRuns() + .delete("myResourceGroup", "myRegistry", "myPipelineRun", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PipelineRunsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PipelineRunsGetSamples.java new file mode 100644 index 0000000000000..5b4ba70716b58 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PipelineRunsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for PipelineRuns Get. */ +public final class PipelineRunsGetSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/PipelineRunGet.json + */ + /** + * Sample code: PipelineRunGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void pipelineRunGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getPipelineRuns() + .getWithResponse("myResourceGroup", "myRegistry", "myPipelineRun", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PipelineRunsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PipelineRunsListSamples.java new file mode 100644 index 0000000000000..d2fece920436b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PipelineRunsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for PipelineRuns List. */ +public final class PipelineRunsListSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/PipelineRunList.json + */ + /** + * Sample code: PipelineRunList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void pipelineRunList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getPipelineRuns() + .list("myResourceGroup", "myRegistry", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..5e78da58305f8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.containerregistry.models.ConnectionStatus; +import com.azure.resourcemanager.containerregistry.models.PrivateLinkServiceConnectionState; + +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/PrivateEndpointConnectionCreateOrUpdate.json + */ + /** + * Sample code: PrivateEndpointConnectionCreateOrUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void privateEndpointConnectionCreateOrUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + "myResourceGroup", + "myRegistry", + "myConnection", + new PrivateEndpointConnectionInner() + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus(ConnectionStatus.APPROVED) + .withDescription("Auto-Approved")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..55749026b063b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PrivateEndpointConnectionsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/PrivateEndpointConnectionDelete.json + */ + /** + * Sample code: PrivateEndpointConnectionDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void privateEndpointConnectionDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getPrivateEndpointConnections() + .delete("myResourceGroup", "myRegistry", "myConnection", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PrivateEndpointConnectionsGetSamples.java new file mode 100644 index 0000000000000..4378182af1778 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PrivateEndpointConnectionsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/PrivateEndpointConnectionGet.json + */ + /** + * Sample code: PrivateEndpointConnectionGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void privateEndpointConnectionGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse("myResourceGroup", "myRegistry", "myConnection", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PrivateEndpointConnectionsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PrivateEndpointConnectionsListSamples.java new file mode 100644 index 0000000000000..18dde00acae22 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/PrivateEndpointConnectionsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections List. */ +public final class PrivateEndpointConnectionsListSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/PrivateEndpointConnectionList.json + */ + /** + * Sample code: PrivateEndpointConnectionList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void privateEndpointConnectionList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getPrivateEndpointConnections() + .list("myResourceGroup", "myRegistry", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesCheckNameAvailabilitySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesCheckNameAvailabilitySamples.java new file mode 100644 index 0000000000000..21cf6dece40e0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesCheckNameAvailabilitySamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.models.RegistryNameCheckRequest; + +/** Samples for Registries CheckNameAvailability. */ +public final class RegistriesCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/RegistryCheckNameAvailable.json + */ + /** + * Sample code: RegistryCheckNameAvailable. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void registryCheckNameAvailable(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .checkNameAvailabilityWithResponse(new RegistryNameCheckRequest().withName("myRegistry"), Context.NONE); + } + + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/RegistryCheckNameNotAvailable.json + */ + /** + * Sample code: RegistryCheckNameNotAvailable. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void registryCheckNameNotAvailable(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .checkNameAvailabilityWithResponse(new RegistryNameCheckRequest().withName("myRegistry"), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesCreateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesCreateSamples.java new file mode 100644 index 0000000000000..4b049902149e4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesCreateSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.fluent.models.RegistryInner; +import com.azure.resourcemanager.containerregistry.models.Sku; +import com.azure.resourcemanager.containerregistry.models.SkuName; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Registries Create. */ +public final class RegistriesCreateSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/RegistryCreate.json + */ + /** + * Sample code: RegistryCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void registryCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .create( + "myResourceGroup", + "myRegistry", + new RegistryInner() + .withLocation("westus") + .withTags(mapOf("key", "value")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withAdminUserEnabled(true), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesDeleteSamples.java new file mode 100644 index 0000000000000..f2429798f973d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Registries Delete. */ +public final class RegistriesDeleteSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/RegistryDelete.json + */ + /** + * Sample code: RegistryDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void registryDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .delete("myResourceGroup", "myRegistry", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesGenerateCredentialsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesGenerateCredentialsSamples.java new file mode 100644 index 0000000000000..5e455ea5d2c88 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesGenerateCredentialsSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.models.GenerateCredentialsParameters; +import java.time.OffsetDateTime; + +/** Samples for Registries GenerateCredentials. */ +public final class RegistriesGenerateCredentialsSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-05-01-preview/examples/RegistryGenerateCredentials.json + */ + /** + * Sample code: RegistryGenerateCredentials. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void registryGenerateCredentials(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .generateCredentials( + "myResourceGroup", + "myRegistry", + new GenerateCredentialsParameters() + .withTokenId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/myToken") + .withExpiry(OffsetDateTime.parse("2020-12-31T15:59:59.0707808Z")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesGetBuildSourceUploadUrlSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesGetBuildSourceUploadUrlSamples.java new file mode 100644 index 0000000000000..cdc946611dc83 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesGetBuildSourceUploadUrlSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Registries GetBuildSourceUploadUrl. */ +public final class RegistriesGetBuildSourceUploadUrlSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesGetBuildSourceUploadUrl.json + */ + /** + * Sample code: Registries_GetBuildSourceUploadUrl. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void registriesGetBuildSourceUploadUrl(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .getBuildSourceUploadUrlWithResponse("myResourceGroup", "myRegistry", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..b1ee75caa9e22 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Registries GetByResourceGroup. */ +public final class RegistriesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/RegistryGet.json + */ + /** + * Sample code: RegistryGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void registryGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .getByResourceGroupWithResponse("myResourceGroup", "myRegistry", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesImportImageSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesImportImageSamples.java new file mode 100644 index 0000000000000..22aa762ecedb8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesImportImageSamples.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.models.ImportImageParameters; +import com.azure.resourcemanager.containerregistry.models.ImportMode; +import com.azure.resourcemanager.containerregistry.models.ImportSource; +import java.util.Arrays; + +/** Samples for Registries ImportImage. */ +public final class RegistriesImportImageSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/ImportImageFromPublicRegistry.json + */ + /** + * Sample code: ImportImageFromPublicRegistry. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void importImageFromPublicRegistry(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .importImage( + "myResourceGroup", + "myRegistry", + new ImportImageParameters() + .withSource( + new ImportSource() + .withRegistryUri("registry.hub.docker.com") + .withSourceImage("library/hello-world")) + .withTargetTags(Arrays.asList("targetRepository:targetTag")) + .withUntaggedTargetRepositories(Arrays.asList("targetRepository1")) + .withMode(ImportMode.FORCE), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/ImportImageByTag.json + */ + /** + * Sample code: ImportImageByTag. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void importImageByTag(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .importImage( + "myResourceGroup", + "myRegistry", + new ImportImageParameters() + .withSource( + new ImportSource() + .withResourceId( + "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/sourceResourceGroup/providers/Microsoft.ContainerRegistry/registries/sourceRegistry") + .withSourceImage("sourceRepository:sourceTag")) + .withTargetTags(Arrays.asList("targetRepository:targetTag")) + .withUntaggedTargetRepositories(Arrays.asList("targetRepository1")) + .withMode(ImportMode.FORCE), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/ImportImageByManifestDigest.json + */ + /** + * Sample code: ImportImageByManifestDigest. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void importImageByManifestDigest(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .importImage( + "myResourceGroup", + "myRegistry", + new ImportImageParameters() + .withSource( + new ImportSource() + .withResourceId( + "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/sourceResourceGroup/providers/Microsoft.ContainerRegistry/registries/sourceRegistry") + .withSourceImage( + "sourceRepository@sha256:0000000000000000000000000000000000000000000000000000000000000000")) + .withTargetTags(Arrays.asList("targetRepository:targetTag")) + .withUntaggedTargetRepositories(Arrays.asList("targetRepository1")) + .withMode(ImportMode.FORCE), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..b64d5eef444a6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesListByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Registries ListByResourceGroup. */ +public final class RegistriesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/RegistryListByResourceGroup.json + */ + /** + * Sample code: RegistryListByResourceGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void registryListByResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .listByResourceGroup("myResourceGroup", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesListCredentialsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesListCredentialsSamples.java new file mode 100644 index 0000000000000..897ca47c5e96f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesListCredentialsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Registries ListCredentials. */ +public final class RegistriesListCredentialsSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/RegistryListCredentials.json + */ + /** + * Sample code: RegistryListCredentials. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void registryListCredentials(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .listCredentialsWithResponse("myResourceGroup", "myRegistry", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesListPrivateLinkResourcesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesListPrivateLinkResourcesSamples.java new file mode 100644 index 0000000000000..ab12ddda3af17 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesListPrivateLinkResourcesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Registries ListPrivateLinkResources. */ +public final class RegistriesListPrivateLinkResourcesSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/RegistryListPrivateLinkResources.json + */ + /** + * Sample code: RegistryListPrivateLinkResources. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void registryListPrivateLinkResources(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .listPrivateLinkResources("myResourceGroup", "myRegistry", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesListSamples.java new file mode 100644 index 0000000000000..e27fd7b3fb86b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesListSamples.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.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Registries List. */ +public final class RegistriesListSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/RegistryList.json + */ + /** + * Sample code: RegistryList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void registryList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.containerRegistries().manager().serviceClient().getRegistries().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesListUsagesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesListUsagesSamples.java new file mode 100644 index 0000000000000..71a5b7d32ac36 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesListUsagesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Registries ListUsages. */ +public final class RegistriesListUsagesSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/RegistryListUsages.json + */ + /** + * Sample code: RegistryListUsages. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void registryListUsages(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .listUsagesWithResponse("myResourceGroup", "myRegistry", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesRegenerateCredentialSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesRegenerateCredentialSamples.java new file mode 100644 index 0000000000000..17325b6abae28 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesRegenerateCredentialSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.models.PasswordName; +import com.azure.resourcemanager.containerregistry.models.RegenerateCredentialParameters; + +/** Samples for Registries RegenerateCredential. */ +public final class RegistriesRegenerateCredentialSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/RegistryRegenerateCredential.json + */ + /** + * Sample code: RegistryRegenerateCredential. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void registryRegenerateCredential(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .regenerateCredentialWithResponse( + "myResourceGroup", + "myRegistry", + new RegenerateCredentialParameters().withName(PasswordName.PASSWORD), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesScheduleRunSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesScheduleRunSamples.java new file mode 100644 index 0000000000000..3f68567320748 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesScheduleRunSamples.java @@ -0,0 +1,338 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.models.AgentProperties; +import com.azure.resourcemanager.containerregistry.models.Architecture; +import com.azure.resourcemanager.containerregistry.models.Argument; +import com.azure.resourcemanager.containerregistry.models.Credentials; +import com.azure.resourcemanager.containerregistry.models.CustomRegistryCredentials; +import com.azure.resourcemanager.containerregistry.models.DockerBuildRequest; +import com.azure.resourcemanager.containerregistry.models.EncodedTaskRunRequest; +import com.azure.resourcemanager.containerregistry.models.FileTaskRunRequest; +import com.azure.resourcemanager.containerregistry.models.OS; +import com.azure.resourcemanager.containerregistry.models.OverrideTaskStepProperties; +import com.azure.resourcemanager.containerregistry.models.PlatformProperties; +import com.azure.resourcemanager.containerregistry.models.SecretObject; +import com.azure.resourcemanager.containerregistry.models.SecretObjectType; +import com.azure.resourcemanager.containerregistry.models.SetValue; +import com.azure.resourcemanager.containerregistry.models.SourceRegistryCredentials; +import com.azure.resourcemanager.containerregistry.models.SourceRegistryLoginMode; +import com.azure.resourcemanager.containerregistry.models.TaskRunRequest; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Registries ScheduleRun. */ +public final class RegistriesScheduleRunSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun_FileTaskRun.json + */ + /** + * Sample code: Registries_ScheduleRun_FileTaskRun. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void registriesScheduleRunFileTaskRun(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .scheduleRun( + "myResourceGroup", + "myRegistry", + new FileTaskRunRequest() + .withTaskFilePath("acb.yaml") + .withValuesFilePath("prod-values.yaml") + .withValues( + Arrays + .asList( + new SetValue().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new SetValue() + .withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true))) + .withPlatform(new PlatformProperties().withOs(OS.LINUX)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withSourceLocation( + "https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun.json + */ + /** + * Sample code: Registries_ScheduleRun. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void registriesScheduleRun(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .scheduleRun( + "myResourceGroup", + "myRegistry", + new DockerBuildRequest() + .withIsArchiveEnabled(true) + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(true) + .withDockerFilePath("DockerFile") + .withArguments( + Arrays + .asList( + new Argument().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new Argument() + .withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true))) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withSourceLocation( + "https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun_EncodedTaskRun.json + */ + /** + * Sample code: Registries_ScheduleRun_EncodedTaskRun. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void registriesScheduleRunEncodedTaskRun(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .scheduleRun( + "myResourceGroup", + "myRegistry", + new EncodedTaskRunRequest() + .withEncodedTaskContent( + "c3RlcHM6Cnt7IGlmIFZhbHVlcy5lbnZpcm9ubWVudCA9PSAncHJvZCcgfX0KICAtIHJ1bjogcHJvZCBzZXR1cAp7eyBlbHNlIGlmIFZhbHVlcy5lbnZpcm9ubWVudCA9PSAnc3RhZ2luZycgfX0KICAtIHJ1bjogc3RhZ2luZyBzZXR1cAp7eyBlbHNlIH19CiAgLSBydW46IGRlZmF1bHQgc2V0dXAKe3sgZW5kIH19CgogIC0gcnVuOiBidWlsZCAtdCBGYW5jeVRoaW5nOnt7LlZhbHVlcy5lbnZpcm9ubWVudH19LXt7LlZhbHVlcy52ZXJzaW9ufX0gLgoKcHVzaDogWydGYW5jeVRoaW5nOnt7LlZhbHVlcy5lbnZpcm9ubWVudH19LXt7LlZhbHVlcy52ZXJzaW9ufX0nXQ==") + .withEncodedValuesContent("ZW52aXJvbm1lbnQ6IHByb2QKdmVyc2lvbjogMQ==") + .withValues( + Arrays + .asList( + new SetValue().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new SetValue() + .withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true))) + .withPlatform(new PlatformProperties().withOs(OS.LINUX)) + .withAgentConfiguration(new AgentProperties().withCpu(2)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun_WithCustomCredentials.json + */ + /** + * Sample code: Registries_ScheduleRun_WithCustomCredentials. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void registriesScheduleRunWithCustomCredentials( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .scheduleRun( + "myResourceGroup", + "myRegistry", + new DockerBuildRequest() + .withIsArchiveEnabled(true) + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(true) + .withDockerFilePath("DockerFile") + .withTarget("stage1") + .withArguments( + Arrays + .asList( + new Argument().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new Argument() + .withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true))) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withSourceLocation( + "https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D") + .withCredentials( + new Credentials() + .withSourceRegistry( + new SourceRegistryCredentials().withLoginMode(SourceRegistryLoginMode.DEFAULT)) + .withCustomRegistries( + mapOf( + "myregistry.azurecr.io", + new CustomRegistryCredentials() + .withUsername( + new SecretObject().withValue("reg1").withType(SecretObjectType.OPAQUE)) + .withPassword( + new SecretObject().withValue("***").withType(SecretObjectType.OPAQUE)), + "myregistry2.azurecr.io", + new CustomRegistryCredentials() + .withUsername( + new SecretObject().withValue("reg2").withType(SecretObjectType.OPAQUE)) + .withPassword( + new SecretObject().withValue("***").withType(SecretObjectType.OPAQUE))))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun_WithLogTemplate.json + */ + /** + * Sample code: Registries_ScheduleRun_WithLogTemplate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void registriesScheduleRunWithLogTemplate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .scheduleRun( + "myResourceGroup", + "myRegistry", + new DockerBuildRequest() + .withIsArchiveEnabled(true) + .withLogTemplate("acr/tasks:{{.Run.OS}}") + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(true) + .withDockerFilePath("DockerFile") + .withArguments( + Arrays + .asList( + new Argument().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new Argument() + .withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true))) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withSourceLocation( + "https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun_Task.json + */ + /** + * Sample code: Registries_ScheduleRun_Task. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void registriesScheduleRunTask(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .scheduleRun( + "myResourceGroup", + "myRegistry", + new TaskRunRequest() + .withTaskId("myTask") + .withOverrideTaskStepProperties( + new OverrideTaskStepProperties() + .withFile("overriddenDockerfile") + .withArguments( + Arrays + .asList( + new Argument() + .withName("mytestargument") + .withValue("mytestvalue") + .withIsSecret(false), + new Argument() + .withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true))) + .withTarget("build") + .withValues( + Arrays + .asList( + new SetValue() + .withName("mytestname") + .withValue("mytestvalue") + .withIsSecret(false), + new SetValue() + .withName("mysecrettestname") + .withValue("mysecrettestvalue") + .withIsSecret(true))) + .withUpdateTriggerToken("aGVsbG8gd29ybGQ=")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RegistriesScheduleRun_FileTask_WithCustomCredentials.json + */ + /** + * Sample code: Registries_ScheduleRun_Task_WithCustomCredentials. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void registriesScheduleRunTaskWithCustomCredentials( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .scheduleRun( + "myResourceGroup", + "myRegistry", + new FileTaskRunRequest() + .withTaskFilePath("acb.yaml") + .withValues( + Arrays + .asList( + new SetValue().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new SetValue() + .withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true))) + .withPlatform(new PlatformProperties().withOs(OS.LINUX)) + .withCredentials( + new Credentials() + .withSourceRegistry( + new SourceRegistryCredentials().withLoginMode(SourceRegistryLoginMode.DEFAULT)) + .withCustomRegistries( + mapOf( + "myregistry.azurecr.io", + new CustomRegistryCredentials() + .withUsername( + new SecretObject().withValue("reg1").withType(SecretObjectType.OPAQUE)) + .withPassword( + new SecretObject().withValue("***").withType(SecretObjectType.OPAQUE))))), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesUpdateSamples.java new file mode 100644 index 0000000000000..f56b99611fd82 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RegistriesUpdateSamples.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.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.models.RegistryUpdateParameters; +import com.azure.resourcemanager.containerregistry.models.Sku; +import com.azure.resourcemanager.containerregistry.models.SkuName; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Registries Update. */ +public final class RegistriesUpdateSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/RegistryUpdate.json + */ + /** + * Sample code: RegistryUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void registryUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRegistries() + .update( + "myResourceGroup", + "myRegistry", + new RegistryUpdateParameters() + .withTags(mapOf("key", "value")) + .withSku(new Sku().withName(SkuName.STANDARD)) + .withAdminUserEnabled(true), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ReplicationsCreateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ReplicationsCreateSamples.java new file mode 100644 index 0000000000000..2a9e4e7c5394f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ReplicationsCreateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.fluent.models.ReplicationInner; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Replications Create. */ +public final class ReplicationsCreateSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/ReplicationCreate.json + */ + /** + * Sample code: ReplicationCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void replicationCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getReplications() + .create( + "myResourceGroup", + "myRegistry", + "myReplication", + new ReplicationInner().withLocation("eastus").withTags(mapOf("key", "value")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ReplicationsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ReplicationsDeleteSamples.java new file mode 100644 index 0000000000000..87ef02b534bb9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ReplicationsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Replications Delete. */ +public final class ReplicationsDeleteSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/ReplicationDelete.json + */ + /** + * Sample code: ReplicationDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void replicationDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getReplications() + .delete("myResourceGroup", "myRegistry", "myReplication", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ReplicationsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ReplicationsGetSamples.java new file mode 100644 index 0000000000000..493fbb234126c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ReplicationsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Replications Get. */ +public final class ReplicationsGetSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/ReplicationGet.json + */ + /** + * Sample code: ReplicationGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void replicationGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getReplications() + .getWithResponse("myResourceGroup", "myRegistry", "myReplication", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ReplicationsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ReplicationsListSamples.java new file mode 100644 index 0000000000000..d37621c2a9306 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ReplicationsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Replications List. */ +public final class ReplicationsListSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/ReplicationList.json + */ + /** + * Sample code: ReplicationList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void replicationList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getReplications() + .list("myResourceGroup", "myRegistry", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ReplicationsUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ReplicationsUpdateSamples.java new file mode 100644 index 0000000000000..3110081244930 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ReplicationsUpdateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.models.ReplicationUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Replications Update. */ +public final class ReplicationsUpdateSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/ReplicationUpdate.json + */ + /** + * Sample code: ReplicationUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void replicationUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getReplications() + .update( + "myResourceGroup", + "myRegistry", + "myReplication", + new ReplicationUpdateParameters().withTags(mapOf("key", "value")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RunsCancelSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RunsCancelSamples.java new file mode 100644 index 0000000000000..f09051b4f03f9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RunsCancelSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Runs Cancel. */ +public final class RunsCancelSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsCancel.json + */ + /** + * Sample code: Runs_Cancel. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void runsCancel(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRuns() + .cancel("myResourceGroup", "myRegistry", "0accec26-d6de-4757-8e74-d080f38eaaab", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RunsGetLogSasUrlSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RunsGetLogSasUrlSamples.java new file mode 100644 index 0000000000000..59e5050171b68 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RunsGetLogSasUrlSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Runs GetLogSasUrl. */ +public final class RunsGetLogSasUrlSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsGetLogSasUrl.json + */ + /** + * Sample code: Runs_GetLogSasUrl. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void runsGetLogSasUrl(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRuns() + .getLogSasUrlWithResponse( + "myResourceGroup", "myRegistry", "0accec26-d6de-4757-8e74-d080f38eaaab", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RunsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RunsGetSamples.java new file mode 100644 index 0000000000000..abd86d084f9c8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RunsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Runs Get. */ +public final class RunsGetSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsGet.json + */ + /** + * Sample code: Runs_Get. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void runsGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRuns() + .getWithResponse("myResourceGroup", "myRegistry", "0accec26-d6de-4757-8e74-d080f38eaaab", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RunsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RunsListSamples.java new file mode 100644 index 0000000000000..69d05479a036c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RunsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Runs List. */ +public final class RunsListSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsList.json + */ + /** + * Sample code: Runs_List. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void runsList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRuns() + .list("myResourceGroup", "myRegistry", "", 10, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RunsUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RunsUpdateSamples.java new file mode 100644 index 0000000000000..b4729fcfc04d3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/RunsUpdateSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.models.RunUpdateParameters; + +/** Samples for Runs Update. */ +public final class RunsUpdateSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/RunsUpdate.json + */ + /** + * Sample code: Runs_Update. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void runsUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getRuns() + .update( + "myResourceGroup", + "myRegistry", + "0accec26-d6de-4757-8e74-d080f38eaaab", + new RunUpdateParameters().withIsArchiveEnabled(true), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ScopeMapsCreateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ScopeMapsCreateSamples.java new file mode 100644 index 0000000000000..e99af59823482 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ScopeMapsCreateSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.fluent.models.ScopeMapInner; +import java.util.Arrays; + +/** Samples for ScopeMaps Create. */ +public final class ScopeMapsCreateSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-05-01-preview/examples/ScopeMapCreate.json + */ + /** + * Sample code: ScopeMapCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void scopeMapCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getScopeMaps() + .create( + "myResourceGroup", + "myRegistry", + "myScopeMap", + new ScopeMapInner() + .withDescription("Developer Scopes") + .withActions( + Arrays.asList("repositories/myrepository/contentWrite", "repositories/myrepository/delete")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ScopeMapsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ScopeMapsDeleteSamples.java new file mode 100644 index 0000000000000..5962ad94c6076 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ScopeMapsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for ScopeMaps Delete. */ +public final class ScopeMapsDeleteSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-05-01-preview/examples/ScopeMapDelete.json + */ + /** + * Sample code: ScopeMapDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void scopeMapDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getScopeMaps() + .delete("myResourceGroup", "myRegistry", "myScopeMap", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ScopeMapsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ScopeMapsGetSamples.java new file mode 100644 index 0000000000000..e9fef3b6622fb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ScopeMapsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for ScopeMaps Get. */ +public final class ScopeMapsGetSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-05-01-preview/examples/ScopeMapGet.json + */ + /** + * Sample code: ScopeMapGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void scopeMapGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getScopeMaps() + .getWithResponse("myResourceGroup", "myRegistry", "myScopeMap", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ScopeMapsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ScopeMapsListSamples.java new file mode 100644 index 0000000000000..d45d7e1dc09dc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ScopeMapsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for ScopeMaps List. */ +public final class ScopeMapsListSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-05-01-preview/examples/ScopeMapList.json + */ + /** + * Sample code: ScopeMapList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void scopeMapList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getScopeMaps() + .list("myResourceGroup", "myRegistry", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ScopeMapsUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ScopeMapsUpdateSamples.java new file mode 100644 index 0000000000000..8e215466b1ed6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/ScopeMapsUpdateSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.models.ScopeMapUpdateParameters; +import java.util.Arrays; + +/** Samples for ScopeMaps Update. */ +public final class ScopeMapsUpdateSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-05-01-preview/examples/ScopeMapUpdate.json + */ + /** + * Sample code: ScopeMapUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void scopeMapUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getScopeMaps() + .update( + "myResourceGroup", + "myRegistry", + "myScopeMap", + new ScopeMapUpdateParameters() + .withDescription("Developer Scopes") + .withActions( + Arrays + .asList("repositories/myrepository/contentWrite", "repositories/myrepository/contentRead")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TaskRunsCreateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TaskRunsCreateSamples.java new file mode 100644 index 0000000000000..389350301d0cc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TaskRunsCreateSamples.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.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.fluent.models.TaskRunInner; +import com.azure.resourcemanager.containerregistry.models.Architecture; +import com.azure.resourcemanager.containerregistry.models.Credentials; +import com.azure.resourcemanager.containerregistry.models.EncodedTaskRunRequest; +import com.azure.resourcemanager.containerregistry.models.OS; +import com.azure.resourcemanager.containerregistry.models.PlatformProperties; +import java.util.Arrays; + +/** Samples for TaskRuns Create. */ +public final class TaskRunsCreateSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsCreate.json + */ + /** + * Sample code: TaskRuns_Create. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void taskRunsCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTaskRuns() + .create( + "myResourceGroup", + "myRegistry", + "myRun", + new TaskRunInner() + .withRunRequest( + new EncodedTaskRunRequest() + .withEncodedTaskContent("c3RlcHM6IAogIC0gY21kOiB7eyAuVmFsdWVzLmNvbW1hbmQgfX0K") + .withEncodedValuesContent("Y29tbWFuZDogYmFzaCBlY2hvIHt7LlJ1bi5SZWdpc3RyeX19Cg==") + .withValues(Arrays.asList()) + .withPlatform( + new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withCredentials(new Credentials())) + .withForceUpdateTag("test"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TaskRunsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TaskRunsDeleteSamples.java new file mode 100644 index 0000000000000..6aa570ded1fb6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TaskRunsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for TaskRuns Delete. */ +public final class TaskRunsDeleteSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsDelete.json + */ + /** + * Sample code: TaskRuns_Delete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void taskRunsDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTaskRuns() + .delete("myResourceGroup", "myRegistry", "myRun", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TaskRunsGetDetailsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TaskRunsGetDetailsSamples.java new file mode 100644 index 0000000000000..3d893514c36a4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TaskRunsGetDetailsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for TaskRuns GetDetails. */ +public final class TaskRunsGetDetailsSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsGetDetails.json + */ + /** + * Sample code: TaskRuns_GetDetails. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void taskRunsGetDetails(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTaskRuns() + .getDetailsWithResponse("myResourceGroup", "myRegistry", "myRun", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TaskRunsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TaskRunsGetSamples.java new file mode 100644 index 0000000000000..185ee2a006582 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TaskRunsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for TaskRuns Get. */ +public final class TaskRunsGetSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsGet.json + */ + /** + * Sample code: TaskRuns_Get. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void taskRunsGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTaskRuns() + .getWithResponse("myResourceGroup", "myRegistry", "myRun", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TaskRunsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TaskRunsListSamples.java new file mode 100644 index 0000000000000..b872e0d1c1fba --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TaskRunsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for TaskRuns List. */ +public final class TaskRunsListSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsList.json + */ + /** + * Sample code: TaskRuns_List. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void taskRunsList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTaskRuns() + .list("myResourceGroup", "myRegistry", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TaskRunsUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TaskRunsUpdateSamples.java new file mode 100644 index 0000000000000..62b1b23488f24 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TaskRunsUpdateSamples.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.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.models.Architecture; +import com.azure.resourcemanager.containerregistry.models.Credentials; +import com.azure.resourcemanager.containerregistry.models.EncodedTaskRunRequest; +import com.azure.resourcemanager.containerregistry.models.OS; +import com.azure.resourcemanager.containerregistry.models.PlatformProperties; +import com.azure.resourcemanager.containerregistry.models.TaskRunUpdateParameters; +import java.util.Arrays; + +/** Samples for TaskRuns Update. */ +public final class TaskRunsUpdateSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TaskRunsUpdate.json + */ + /** + * Sample code: TaskRuns_Update. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void taskRunsUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTaskRuns() + .update( + "myResourceGroup", + "myRegistry", + "myRun", + new TaskRunUpdateParameters() + .withRunRequest( + new EncodedTaskRunRequest() + .withIsArchiveEnabled(true) + .withEncodedTaskContent("c3RlcHM6IAogIC0gY21kOiB7eyAuVmFsdWVzLmNvbW1hbmQgfX0K") + .withEncodedValuesContent("Y29tbWFuZDogYmFzaCBlY2hvIHt7LlJ1bi5SZWdpc3RyeX19Cg==") + .withValues(Arrays.asList()) + .withPlatform( + new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withCredentials(new Credentials())) + .withForceUpdateTag("test"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TasksCreateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TasksCreateSamples.java new file mode 100644 index 0000000000000..902ceff97c3ec --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TasksCreateSamples.java @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.fluent.models.TaskInner; +import com.azure.resourcemanager.containerregistry.models.AgentProperties; +import com.azure.resourcemanager.containerregistry.models.Architecture; +import com.azure.resourcemanager.containerregistry.models.Argument; +import com.azure.resourcemanager.containerregistry.models.AuthInfo; +import com.azure.resourcemanager.containerregistry.models.BaseImageTrigger; +import com.azure.resourcemanager.containerregistry.models.BaseImageTriggerType; +import com.azure.resourcemanager.containerregistry.models.DockerTaskStep; +import com.azure.resourcemanager.containerregistry.models.IdentityProperties; +import com.azure.resourcemanager.containerregistry.models.OS; +import com.azure.resourcemanager.containerregistry.models.PlatformProperties; +import com.azure.resourcemanager.containerregistry.models.ResourceIdentityType; +import com.azure.resourcemanager.containerregistry.models.SourceControlType; +import com.azure.resourcemanager.containerregistry.models.SourceProperties; +import com.azure.resourcemanager.containerregistry.models.SourceTrigger; +import com.azure.resourcemanager.containerregistry.models.SourceTriggerEvent; +import com.azure.resourcemanager.containerregistry.models.TaskStatus; +import com.azure.resourcemanager.containerregistry.models.TimerTrigger; +import com.azure.resourcemanager.containerregistry.models.TokenType; +import com.azure.resourcemanager.containerregistry.models.TriggerProperties; +import com.azure.resourcemanager.containerregistry.models.UpdateTriggerPayloadType; +import com.azure.resourcemanager.containerregistry.models.UserIdentityProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Tasks Create. */ +public final class TasksCreateSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/ManagedIdentity/TasksCreate_WithSystemIdentity.json + */ + /** + * Sample code: Tasks_Create_WithUserIdentities_WithSystemIdentity. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tasksCreateWithUserIdentitiesWithSystemIdentity( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTasks() + .create( + "myResourceGroup", + "myRegistry", + "mytTask", + new TaskInner() + .withLocation("eastus") + .withTags(mapOf("testkey", "value")) + .withIdentity(new IdentityProperties().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) + .withStatus(TaskStatus.ENABLED) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withStep( + new DockerTaskStep() + .withContextPath("src") + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(false) + .withDockerFilePath("src/DockerFile") + .withArguments( + Arrays + .asList( + new Argument() + .withName("mytestargument") + .withValue("mytestvalue") + .withIsSecret(false), + new Argument() + .withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true)))) + .withTrigger( + new TriggerProperties() + .withTimerTriggers( + Arrays + .asList(new TimerTrigger().withSchedule("30 9 * * 1-5").withName("myTimerTrigger"))) + .withSourceTriggers( + Arrays + .asList( + new SourceTrigger() + .withSourceRepository( + new SourceProperties() + .withSourceControlType(SourceControlType.GITHUB) + .withRepositoryUrl("https://github.com/Azure/azure-rest-api-specs") + .withBranch("master") + .withSourceControlAuthProperties( + new AuthInfo().withTokenType(TokenType.PAT).withToken("xxxxx"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger"))) + .withBaseImageTrigger( + new BaseImageTrigger() + .withBaseImageTriggerType(BaseImageTriggerType.RUNTIME) + .withName("myBaseImageTrigger"))) + .withIsSystemTask(false), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksCreate.json + */ + /** + * Sample code: Tasks_Create. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tasksCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTasks() + .create( + "myResourceGroup", + "myRegistry", + "mytTask", + new TaskInner() + .withLocation("eastus") + .withTags(mapOf("testkey", "value")) + .withIdentity(new IdentityProperties().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) + .withStatus(TaskStatus.ENABLED) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withStep( + new DockerTaskStep() + .withContextPath("src") + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(false) + .withDockerFilePath("src/DockerFile") + .withArguments( + Arrays + .asList( + new Argument() + .withName("mytestargument") + .withValue("mytestvalue") + .withIsSecret(false), + new Argument() + .withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true)))) + .withTrigger( + new TriggerProperties() + .withTimerTriggers( + Arrays + .asList(new TimerTrigger().withSchedule("30 9 * * 1-5").withName("myTimerTrigger"))) + .withSourceTriggers( + Arrays + .asList( + new SourceTrigger() + .withSourceRepository( + new SourceProperties() + .withSourceControlType(SourceControlType.GITHUB) + .withRepositoryUrl("https://github.com/Azure/azure-rest-api-specs") + .withBranch("master") + .withSourceControlAuthProperties( + new AuthInfo().withTokenType(TokenType.PAT).withToken("xxxxx"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger"))) + .withBaseImageTrigger( + new BaseImageTrigger() + .withBaseImageTriggerType(BaseImageTriggerType.RUNTIME) + .withUpdateTriggerEndpoint("https://user:pass@mycicd.webhook.com?token=foo") + .withUpdateTriggerPayloadType(UpdateTriggerPayloadType.TOKEN) + .withName("myBaseImageTrigger"))) + .withLogTemplate("acr/tasks:{{.Run.OS}}") + .withIsSystemTask(false), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/ManagedIdentity/TasksCreate_WithSystemAndUserIdentities.json + */ + /** + * Sample code: Tasks_Create_WithSystemAndUserIdentities. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tasksCreateWithSystemAndUserIdentities(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTasks() + .create( + "myResourceGroup", + "myRegistry", + "mytTask", + new TaskInner() + .withLocation("eastus") + .withTags(mapOf("testkey", "value")) + .withIdentity( + new IdentityProperties() + .withType(ResourceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2", + new UserIdentityProperties()))) + .withStatus(TaskStatus.ENABLED) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withStep( + new DockerTaskStep() + .withContextPath("src") + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(false) + .withDockerFilePath("src/DockerFile") + .withArguments( + Arrays + .asList( + new Argument() + .withName("mytestargument") + .withValue("mytestvalue") + .withIsSecret(false), + new Argument() + .withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true)))) + .withTrigger( + new TriggerProperties() + .withTimerTriggers( + Arrays + .asList(new TimerTrigger().withSchedule("30 9 * * 1-5").withName("myTimerTrigger"))) + .withSourceTriggers( + Arrays + .asList( + new SourceTrigger() + .withSourceRepository( + new SourceProperties() + .withSourceControlType(SourceControlType.GITHUB) + .withRepositoryUrl("https://github.com/Azure/azure-rest-api-specs") + .withBranch("master") + .withSourceControlAuthProperties( + new AuthInfo().withTokenType(TokenType.PAT).withToken("xxxxx"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger"))) + .withBaseImageTrigger( + new BaseImageTrigger() + .withBaseImageTriggerType(BaseImageTriggerType.RUNTIME) + .withUpdateTriggerEndpoint("https://user:pass@mycicd.webhook.com?token=foo") + .withUpdateTriggerPayloadType(UpdateTriggerPayloadType.DEFAULT) + .withName("myBaseImageTrigger"))) + .withIsSystemTask(false), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/ManagedIdentity/TasksCreate_WithUserIdentities.json + */ + /** + * Sample code: Tasks_Create_WithUserIdentities. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tasksCreateWithUserIdentities(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTasks() + .create( + "myResourceGroup", + "myRegistry", + "mytTask", + new TaskInner() + .withLocation("eastus") + .withTags(mapOf("testkey", "value")) + .withIdentity( + new IdentityProperties() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1", + new UserIdentityProperties(), + "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2", + new UserIdentityProperties()))) + .withStatus(TaskStatus.ENABLED) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withStep( + new DockerTaskStep() + .withContextPath("src") + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(false) + .withDockerFilePath("src/DockerFile") + .withArguments( + Arrays + .asList( + new Argument() + .withName("mytestargument") + .withValue("mytestvalue") + .withIsSecret(false), + new Argument() + .withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true)))) + .withTrigger( + new TriggerProperties() + .withTimerTriggers( + Arrays + .asList(new TimerTrigger().withSchedule("30 9 * * 1-5").withName("myTimerTrigger"))) + .withSourceTriggers( + Arrays + .asList( + new SourceTrigger() + .withSourceRepository( + new SourceProperties() + .withSourceControlType(SourceControlType.GITHUB) + .withRepositoryUrl("https://github.com/Azure/azure-rest-api-specs") + .withBranch("master") + .withSourceControlAuthProperties( + new AuthInfo().withTokenType(TokenType.PAT).withToken("xxxxx"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger"))) + .withBaseImageTrigger( + new BaseImageTrigger() + .withBaseImageTriggerType(BaseImageTriggerType.RUNTIME) + .withUpdateTriggerEndpoint("https://user:pass@mycicd.webhook.com?token=foo") + .withUpdateTriggerPayloadType(UpdateTriggerPayloadType.DEFAULT) + .withName("myBaseImageTrigger"))) + .withIsSystemTask(false), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksCreate_QuickTask.json + */ + /** + * Sample code: Tasks_Create_QuickTask. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tasksCreateQuickTask(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTasks() + .create( + "myResourceGroup", + "myRegistry", + "quicktask", + new TaskInner() + .withLocation("eastus") + .withTags(mapOf("testkey", "value")) + .withStatus(TaskStatus.ENABLED) + .withLogTemplate("acr/tasks:{{.Run.OS}}") + .withIsSystemTask(true), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TasksDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TasksDeleteSamples.java new file mode 100644 index 0000000000000..3686afe3f7bf0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TasksDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Tasks Delete. */ +public final class TasksDeleteSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksDelete.json + */ + /** + * Sample code: Tasks_Delete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tasksDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTasks() + .delete("myResourceGroup", "myRegistry", "myTask", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TasksGetDetailsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TasksGetDetailsSamples.java new file mode 100644 index 0000000000000..da1609ff21cdf --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TasksGetDetailsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Tasks GetDetails. */ +public final class TasksGetDetailsSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksGetDetails.json + */ + /** + * Sample code: Tasks_GetDetails. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tasksGetDetails(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTasks() + .getDetailsWithResponse("myResourceGroup", "myRegistry", "myTask", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TasksGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TasksGetSamples.java new file mode 100644 index 0000000000000..bdc7892f50846 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TasksGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Tasks Get. */ +public final class TasksGetSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksGet.json + */ + /** + * Sample code: Tasks_Get. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tasksGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTasks() + .getWithResponse("myResourceGroup", "myRegistry", "myTask", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TasksListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TasksListSamples.java new file mode 100644 index 0000000000000..e4414aad531dc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TasksListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Tasks List. */ +public final class TasksListSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksList.json + */ + /** + * Sample code: Tasks_List. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tasksList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTasks() + .list("myResourceGroup", "myRegistry", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TasksUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TasksUpdateSamples.java new file mode 100644 index 0000000000000..4d596b8ad3b20 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TasksUpdateSamples.java @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.models.AgentProperties; +import com.azure.resourcemanager.containerregistry.models.AuthInfoUpdateParameters; +import com.azure.resourcemanager.containerregistry.models.Credentials; +import com.azure.resourcemanager.containerregistry.models.CustomRegistryCredentials; +import com.azure.resourcemanager.containerregistry.models.DockerBuildStepUpdateParameters; +import com.azure.resourcemanager.containerregistry.models.SecretObject; +import com.azure.resourcemanager.containerregistry.models.SecretObjectType; +import com.azure.resourcemanager.containerregistry.models.SourceTriggerEvent; +import com.azure.resourcemanager.containerregistry.models.SourceTriggerUpdateParameters; +import com.azure.resourcemanager.containerregistry.models.SourceUpdateParameters; +import com.azure.resourcemanager.containerregistry.models.TaskStatus; +import com.azure.resourcemanager.containerregistry.models.TaskUpdateParameters; +import com.azure.resourcemanager.containerregistry.models.TokenType; +import com.azure.resourcemanager.containerregistry.models.TriggerUpdateParameters; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Tasks Update. */ +public final class TasksUpdateSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksUpdate_QuickTask.json + */ + /** + * Sample code: Tasks_Update_QuickTask. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tasksUpdateQuickTask(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTasks() + .update( + "myResourceGroup", + "myRegistry", + "quicktask", + new TaskUpdateParameters() + .withTags(mapOf("testkey", "value")) + .withStatus(TaskStatus.ENABLED) + .withLogTemplate("acr/tasks:{{.Run.OS}}"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/ManagedIdentity/TasksUpdate_WithMSICustomCredentials.json + */ + /** + * Sample code: Tasks_Update_WithMSICustomCredentials. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tasksUpdateWithMSICustomCredentials(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTasks() + .update( + "myResourceGroup", + "myRegistry", + "myTask", + new TaskUpdateParameters() + .withTags(mapOf("testkey", "value")) + .withStatus(TaskStatus.ENABLED) + .withAgentConfiguration(new AgentProperties().withCpu(3)) + .withStep( + new DockerBuildStepUpdateParameters() + .withImageNames(Arrays.asList("azurerest:testtag1")) + .withDockerFilePath("src/DockerFile")) + .withTrigger( + new TriggerUpdateParameters() + .withSourceTriggers( + Arrays + .asList( + new SourceTriggerUpdateParameters() + .withSourceRepository( + new SourceUpdateParameters() + .withSourceControlAuthProperties( + new AuthInfoUpdateParameters() + .withTokenType(TokenType.PAT) + .withToken("xxxxx"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger")))) + .withCredentials( + new Credentials() + .withCustomRegistries( + mapOf( + "myregistry.azurecr.io", + new CustomRegistryCredentials().withIdentity("[system]")))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/ManagedIdentity/TasksUpdate_WithKeyVaultCustomCredentials.json + */ + /** + * Sample code: Tasks_Update_WithKeyVaultCustomCredentials. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tasksUpdateWithKeyVaultCustomCredentials(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTasks() + .update( + "myResourceGroup", + "myRegistry", + "myTask", + new TaskUpdateParameters() + .withTags(mapOf("testkey", "value")) + .withStatus(TaskStatus.ENABLED) + .withAgentConfiguration(new AgentProperties().withCpu(3)) + .withStep( + new DockerBuildStepUpdateParameters() + .withImageNames(Arrays.asList("azurerest:testtag1")) + .withDockerFilePath("src/DockerFile")) + .withTrigger( + new TriggerUpdateParameters() + .withSourceTriggers( + Arrays + .asList( + new SourceTriggerUpdateParameters() + .withSourceRepository( + new SourceUpdateParameters() + .withSourceControlAuthProperties( + new AuthInfoUpdateParameters() + .withTokenType(TokenType.PAT) + .withToken("xxxxx"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger")))) + .withCredentials( + new Credentials() + .withCustomRegistries( + mapOf( + "myregistry.azurecr.io", + new CustomRegistryCredentials() + .withUsername( + new SecretObject() + .withValue("https://myacbvault.vault.azure.net/secrets/username") + .withType(SecretObjectType.VAULTSECRET)) + .withPassword( + new SecretObject() + .withValue("https://myacbvault.vault.azure.net/secrets/password") + .withType(SecretObjectType.VAULTSECRET)) + .withIdentity("[system]")))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksUpdate.json + */ + /** + * Sample code: Tasks_Update. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tasksUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTasks() + .update( + "myResourceGroup", + "myRegistry", + "myTask", + new TaskUpdateParameters() + .withTags(mapOf("testkey", "value")) + .withStatus(TaskStatus.ENABLED) + .withAgentConfiguration(new AgentProperties().withCpu(3)) + .withStep( + new DockerBuildStepUpdateParameters() + .withImageNames(Arrays.asList("azurerest:testtag1")) + .withDockerFilePath("src/DockerFile")) + .withTrigger( + new TriggerUpdateParameters() + .withSourceTriggers( + Arrays + .asList( + new SourceTriggerUpdateParameters() + .withSourceRepository( + new SourceUpdateParameters() + .withSourceControlAuthProperties( + new AuthInfoUpdateParameters() + .withTokenType(TokenType.PAT) + .withToken("xxxxx"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger")))) + .withCredentials( + new Credentials() + .withCustomRegistries( + mapOf( + "myregistry.azurecr.io", + new CustomRegistryCredentials() + .withUsername( + new SecretObject().withValue("username").withType(SecretObjectType.OPAQUE)) + .withPassword( + new SecretObject() + .withValue("https://myacbvault.vault.azure.net/secrets/password") + .withType(SecretObjectType.VAULTSECRET)) + .withIdentity("[system]")))) + .withLogTemplate("acr/tasks:{{.Run.OS}}"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-06-01-preview/examples/TasksUpdate_WithOpaqueCustomCredentials.json + */ + /** + * Sample code: Tasks_Update_WithOpaqueCustomCredentials. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tasksUpdateWithOpaqueCustomCredentials(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTasks() + .update( + "myResourceGroup", + "myRegistry", + "myTask", + new TaskUpdateParameters() + .withTags(mapOf("testkey", "value")) + .withStatus(TaskStatus.ENABLED) + .withAgentConfiguration(new AgentProperties().withCpu(3)) + .withStep( + new DockerBuildStepUpdateParameters() + .withImageNames(Arrays.asList("azurerest:testtag1")) + .withDockerFilePath("src/DockerFile")) + .withTrigger( + new TriggerUpdateParameters() + .withSourceTriggers( + Arrays + .asList( + new SourceTriggerUpdateParameters() + .withSourceRepository( + new SourceUpdateParameters() + .withSourceControlAuthProperties( + new AuthInfoUpdateParameters() + .withTokenType(TokenType.PAT) + .withToken("xxxxx"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger")))) + .withCredentials( + new Credentials() + .withCustomRegistries( + mapOf( + "myregistry.azurecr.io", + new CustomRegistryCredentials() + .withUsername( + new SecretObject().withValue("username").withType(SecretObjectType.OPAQUE)) + .withPassword( + new SecretObject().withValue("***").withType(SecretObjectType.OPAQUE))))), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TokensCreateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TokensCreateSamples.java new file mode 100644 index 0000000000000..0a5ca09c90065 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TokensCreateSamples.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.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.fluent.models.TokenInner; +import com.azure.resourcemanager.containerregistry.models.TokenCertificate; +import com.azure.resourcemanager.containerregistry.models.TokenCertificateName; +import com.azure.resourcemanager.containerregistry.models.TokenCredentialsProperties; +import com.azure.resourcemanager.containerregistry.models.TokenStatus; +import java.util.Arrays; + +/** Samples for Tokens Create. */ +public final class TokensCreateSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-05-01-preview/examples/TokenCreate.json + */ + /** + * Sample code: TokenCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tokenCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTokens() + .create( + "myResourceGroup", + "myRegistry", + "myToken", + new TokenInner() + .withScopeMapId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/scopeMaps/myScopeMap") + .withCredentials( + new TokenCredentialsProperties() + .withCertificates( + Arrays + .asList( + new TokenCertificate() + .withName(TokenCertificateName.CERTIFICATE1) + .withEncodedPemCertificate( + "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUc3akNDQk5hZ0F3SUJBZ0lURmdBQlR3UVpyZGdmdmhxdzBnQUFBQUZQQkRBTkJna3Foa2lHOXcwQkFRc0YKQURDQml6RUxNQWtHQTFVRUJoTUNWVk14RXpBUkJnTlZCQWdUQ2xkaGMyaHBibWQwYjI0eEVEQU9CZ05WQkFjVApCMUpsWkcxdmJtUXhIakFjQmdOVkJBb1RGVTFwWTNKdmMyOW1kQ0JEYjNKd2IzSmhkR2x2YmpFVk1CTUdBMVVFCkN4TU1UV2xqY205emIyWjBJRWxVTVI0d0hBWURWUVFERXhWTmFXTnliM052Wm5RZ1NWUWdWRXhUSUVOQklEUXcKSGhjTk1UZ3dOREV5TWpJek1qUTRXaGNOTWpBd05ERXlNakl6TWpRNFdqQTVNVGN3TlFZRFZRUURFeTV6WlhKMgphV05sWTJ4cFpXNTBZMlZ5ZEMxd1lYSjBibVZ5TG0xaGJtRm5aVzFsYm5RdVlYcDFjbVV1WTI5dE1JSUJJakFOCkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQTBSYjdJcHpxMmR4emhhbVpyS1ZDakMzeTQyYlYKUnNIY2pCUTFuSDBHZ1puUDhXeDZDSE1mWThybkVJQzRLeVRRYkJXVzhnNXlmc3NSQ0ZXbFpxYjR6SkRXS0pmTgpGSmNMUm9LNnhwTktZYVZVTkVlT25IdUxHYTM0ZlA0VjBFRjZybzdvbkRLME5zanhjY1dZVzRNVXVzc0xrQS94CkUrM2RwU1REdk1KcjJoWUpsVnFDcVR6blQvbmZaVUZzQUVEQnp5MUpOOHZiZDlIR2czc2Myd0x4dk95cFJOc0gKT1V3V2pmN2xzWWZleEVlcWkzY29EeHc2alpLVWEyVkdsUnBpTkowMjhBQitYSi9TU1FVNVBsd0JBbU9TT3ovRApGY0NKdGpPZlBqU1NKckFIQVV3SHU3RzlSV05JTFBwYU9zQ1J5eitETE5zNGpvNlEvUUg4d1lManJRSURBUUFCCm80SUNtakNDQXBZd0N3WURWUjBQQkFRREFnU3dNQjBHQTFVZEpRUVdNQlFHQ0NzR0FRVUZCd01DQmdnckJnRUYKQlFjREFUQWRCZ05WSFE0RUZnUVVlbEdkVVJrZzJoSFFOWEQ4WUc4L3drdjJVT0F3SHdZRFZSMGpCQmd3Rm9BVQplbnVNd2Mvbm9Nb2MxR3Y2KytFend3OGFvcDB3Z2F3R0ExVWRId1NCcERDQm9UQ0JucUNCbTZDQm1JWkxhSFIwCmNEb3ZMMjF6WTNKc0xtMXBZM0p2YzI5bWRDNWpiMjB2Y0d0cEwyMXpZMjl5Y0M5amNtd3ZUV2xqY205emIyWjAKSlRJd1NWUWxNakJVVEZNbE1qQkRRU1V5TURRdVkzSnNoa2xvZEhSd09pOHZZM0pzTG0xcFkzSnZjMjltZEM1agpiMjB2Y0d0cEwyMXpZMjl5Y0M5amNtd3ZUV2xqY205emIyWjBKVEl3U1ZRbE1qQlVURk1sTWpCRFFTVXlNRFF1ClkzSnNNSUdGQmdnckJnRUZCUWNCQVFSNU1IY3dVUVlJS3dZQkJRVUhNQUtHUldoMGRIQTZMeTkzZDNjdWJXbGoKY205emIyWjBMbU52YlM5d2Eya3ZiWE5qYjNKd0wwMXBZM0p2YzI5bWRDVXlNRWxVSlRJd1ZFeFRKVEl3UTBFbApNakEwTG1OeWREQWlCZ2dyQmdFRkJRY3dBWVlXYUhSMGNEb3ZMMjlqYzNBdWJYTnZZM053TG1OdmJUQStCZ2tyCkJnRUVBWUkzRlFjRU1UQXZCaWNyQmdFRUFZSTNGUWlIMm9aMWcrN1pBWUxKaFJ1QnRaNWhoZlRyWUlGZGhOTGYKUW9Mbmszb0NBV1FDQVIwd1RRWURWUjBnQkVZd1JEQkNCZ2tyQmdFRUFZSTNLZ0V3TlRBekJnZ3JCZ0VGQlFjQwpBUlluYUhSMGNEb3ZMM2QzZHk1dGFXTnliM052Wm5RdVkyOXRMM0JyYVM5dGMyTnZjbkF2WTNCek1DY0dDU3NHCkFRUUJnamNWQ2dRYU1CZ3dDZ1lJS3dZQkJRVUhBd0l3Q2dZSUt3WUJCUVVIQXdFd09RWURWUjBSQkRJd01JSXUKYzJWeWRtbGpaV05zYVdWdWRHTmxjblF0Y0dGeWRHNWxjaTV0WVc1aFoyVnRaVzUwTG1GNmRYSmxMbU52YlRBTgpCZ2txaGtpRzl3MEJBUXNGQUFPQ0FnRUFIVXIzbk1vdUI5WWdDUlRWYndUTllIS2RkWGJkSW1GUXNDYys4T1g1CjE5c0N6dFFSR05iSXEwVW1Ba01MbFVvWTIxckh4ZXdxU2hWczFhL2RwaFh5Tk1pcUdaU2QzU1BtYzZscitqUFQKNXVEREs0MUlWeXN0K2VUNlpyazFvcCtMVmdkeS9EU2lyNzVqcWZFY016bS82bU8rNnFNeWRLTWtVYmM5K3JHVwphUkpUcjRWUUdIRmEwNEIwZVZpNUd4MG9pL2RpZDNSaXg2aXJMMjFJSGEwYjN6c1hzZHpHU0R2K3hqL2Q2S0l4Ckdrd2FhYmZvU1NoQnFqaFNlQ0VyZXFlb1RpYjljdGw0MGRVdUp3THl4bjhHS2N6K3AvMEJUOEIxU3lYK01OQ2wKY0pkMjVtMjhLajY2TGUxOEVyeFlJYXZJVGVGa3Y2eGZjdkEvcHladDdPaU41QTlGQk1IUmpQK1kyZ2tvdjMrcQpISFRUZG4xNnlRajduNit3YlFHNGVleXc0YisyQkRLcUxNVFU2ZmlSQ3ZPM2FPZVBLSFVNN3R4b1FidWl6Z3NzCkNiMzl3QnJOTEZsMkJLQ1RkSCtkSU9oZVJiSkZvbmlwOGRPOUVFZWdSSG9lQW54ZUlYTFBrdXMzTzEvZjRhNkIKWHQ3RG5BUm8xSzJmeEp3VXRaU2MvR3dFSjU5NzlnRXlEa3pDZEVsLzdpWE9QZXVjTXhlM2xVM2pweUtsNERUaApjSkJqQytqNGpLWTFrK1U4b040aGdqYnJISUx6Vnd2eU15OU5KS290U3BMSjQxeHdPOHlGangxalFTT3Bxc0N1ClFhUFUvTjhSZ0hxWjBGTkFzS3dNUmZ6WmdXanRCNzRzYUVEdk5jVmNuNFhCQnFNSG0ydHo2Uzk3d3kxZGt0cTgKSE5BPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==")))) + .withStatus(TokenStatus.DISABLED), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TokensDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TokensDeleteSamples.java new file mode 100644 index 0000000000000..d68d1232ef891 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TokensDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Tokens Delete. */ +public final class TokensDeleteSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-05-01-preview/examples/TokenDelete.json + */ + /** + * Sample code: TokenDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tokenDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTokens() + .delete("myResourceGroup", "myRegistry", "myToken", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TokensGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TokensGetSamples.java new file mode 100644 index 0000000000000..706216100a9f1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TokensGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Tokens Get. */ +public final class TokensGetSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-05-01-preview/examples/TokenGet.json + */ + /** + * Sample code: TokenGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tokenGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTokens() + .getWithResponse("myResourceGroup", "myRegistry", "myToken", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TokensListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TokensListSamples.java new file mode 100644 index 0000000000000..72a438ec3ba9a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TokensListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Tokens List. */ +public final class TokensListSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-05-01-preview/examples/TokenList.json + */ + /** + * Sample code: TokenList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tokenList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTokens() + .list("myResourceGroup", "myRegistry", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TokensUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TokensUpdateSamples.java new file mode 100644 index 0000000000000..fed29d5a2b714 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/TokensUpdateSamples.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.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.models.TokenCertificate; +import com.azure.resourcemanager.containerregistry.models.TokenCertificateName; +import com.azure.resourcemanager.containerregistry.models.TokenCredentialsProperties; +import com.azure.resourcemanager.containerregistry.models.TokenUpdateParameters; +import java.util.Arrays; + +/** Samples for Tokens Update. */ +public final class TokensUpdateSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-05-01-preview/examples/TokenUpdate.json + */ + /** + * Sample code: TokenUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tokenUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getTokens() + .update( + "myResourceGroup", + "myRegistry", + "myToken", + new TokenUpdateParameters() + .withScopeMapId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/scopeMaps/myNewScopeMap") + .withCredentials( + new TokenCredentialsProperties() + .withCertificates( + Arrays + .asList( + new TokenCertificate() + .withName(TokenCertificateName.CERTIFICATE1) + .withEncodedPemCertificate( + "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUc3akNDQk5hZ0F3SUJBZ0lURmdBQlR3UVpyZGdmdmhxdzBnQUFBQUZQQkRBTkJna3Foa2lHOXcwQkFRc0YKQURDQml6RUxNQWtHQTFVRUJoTUNWVk14RXpBUkJnTlZCQWdUQ2xkaGMyaHBibWQwYjI0eEVEQU9CZ05WQkFjVApCMUpsWkcxdmJtUXhIakFjQmdOVkJBb1RGVTFwWTNKdmMyOW1kQ0JEYjNKd2IzSmhkR2x2YmpFVk1CTUdBMVVFCkN4TU1UV2xqY205emIyWjBJRWxVTVI0d0hBWURWUVFERXhWTmFXTnliM052Wm5RZ1NWUWdWRXhUSUVOQklEUXcKSGhjTk1UZ3dOREV5TWpJek1qUTRXaGNOTWpBd05ERXlNakl6TWpRNFdqQTVNVGN3TlFZRFZRUURFeTV6WlhKMgphV05sWTJ4cFpXNTBZMlZ5ZEMxd1lYSjBibVZ5TG0xaGJtRm5aVzFsYm5RdVlYcDFjbVV1WTI5dE1JSUJJakFOCkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQTBSYjdJcHpxMmR4emhhbVpyS1ZDakMzeTQyYlYKUnNIY2pCUTFuSDBHZ1puUDhXeDZDSE1mWThybkVJQzRLeVRRYkJXVzhnNXlmc3NSQ0ZXbFpxYjR6SkRXS0pmTgpGSmNMUm9LNnhwTktZYVZVTkVlT25IdUxHYTM0ZlA0VjBFRjZybzdvbkRLME5zanhjY1dZVzRNVXVzc0xrQS94CkUrM2RwU1REdk1KcjJoWUpsVnFDcVR6blQvbmZaVUZzQUVEQnp5MUpOOHZiZDlIR2czc2Myd0x4dk95cFJOc0gKT1V3V2pmN2xzWWZleEVlcWkzY29EeHc2alpLVWEyVkdsUnBpTkowMjhBQitYSi9TU1FVNVBsd0JBbU9TT3ovRApGY0NKdGpPZlBqU1NKckFIQVV3SHU3RzlSV05JTFBwYU9zQ1J5eitETE5zNGpvNlEvUUg4d1lManJRSURBUUFCCm80SUNtakNDQXBZd0N3WURWUjBQQkFRREFnU3dNQjBHQTFVZEpRUVdNQlFHQ0NzR0FRVUZCd01DQmdnckJnRUYKQlFjREFUQWRCZ05WSFE0RUZnUVVlbEdkVVJrZzJoSFFOWEQ4WUc4L3drdjJVT0F3SHdZRFZSMGpCQmd3Rm9BVQplbnVNd2Mvbm9Nb2MxR3Y2KytFend3OGFvcDB3Z2F3R0ExVWRId1NCcERDQm9UQ0JucUNCbTZDQm1JWkxhSFIwCmNEb3ZMMjF6WTNKc0xtMXBZM0p2YzI5bWRDNWpiMjB2Y0d0cEwyMXpZMjl5Y0M5amNtd3ZUV2xqY205emIyWjAKSlRJd1NWUWxNakJVVEZNbE1qQkRRU1V5TURRdVkzSnNoa2xvZEhSd09pOHZZM0pzTG0xcFkzSnZjMjltZEM1agpiMjB2Y0d0cEwyMXpZMjl5Y0M5amNtd3ZUV2xqY205emIyWjBKVEl3U1ZRbE1qQlVURk1sTWpCRFFTVXlNRFF1ClkzSnNNSUdGQmdnckJnRUZCUWNCQVFSNU1IY3dVUVlJS3dZQkJRVUhNQUtHUldoMGRIQTZMeTkzZDNjdWJXbGoKY205emIyWjBMbU52YlM5d2Eya3ZiWE5qYjNKd0wwMXBZM0p2YzI5bWRDVXlNRWxVSlRJd1ZFeFRKVEl3UTBFbApNakEwTG1OeWREQWlCZ2dyQmdFRkJRY3dBWVlXYUhSMGNEb3ZMMjlqYzNBdWJYTnZZM053TG1OdmJUQStCZ2tyCkJnRUVBWUkzRlFjRU1UQXZCaWNyQmdFRUFZSTNGUWlIMm9aMWcrN1pBWUxKaFJ1QnRaNWhoZlRyWUlGZGhOTGYKUW9Mbmszb0NBV1FDQVIwd1RRWURWUjBnQkVZd1JEQkNCZ2tyQmdFRUFZSTNLZ0V3TlRBekJnZ3JCZ0VGQlFjQwpBUlluYUhSMGNEb3ZMM2QzZHk1dGFXTnliM052Wm5RdVkyOXRMM0JyYVM5dGMyTnZjbkF2WTNCek1DY0dDU3NHCkFRUUJnamNWQ2dRYU1CZ3dDZ1lJS3dZQkJRVUhBd0l3Q2dZSUt3WUJCUVVIQXdFd09RWURWUjBSQkRJd01JSXUKYzJWeWRtbGpaV05zYVdWdWRHTmxjblF0Y0dGeWRHNWxjaTV0WVc1aFoyVnRaVzUwTG1GNmRYSmxMbU52YlRBTgpCZ2txaGtpRzl3MEJBUXNGQUFPQ0FnRUFIVXIzbk1vdUI5WWdDUlRWYndUTllIS2RkWGJkSW1GUXNDYys4T1g1CjE5c0N6dFFSR05iSXEwVW1Ba01MbFVvWTIxckh4ZXdxU2hWczFhL2RwaFh5Tk1pcUdaU2QzU1BtYzZscitqUFQKNXVEREs0MUlWeXN0K2VUNlpyazFvcCtMVmdkeS9EU2lyNzVqcWZFY016bS82bU8rNnFNeWRLTWtVYmM5K3JHVwphUkpUcjRWUUdIRmEwNEIwZVZpNUd4MG9pL2RpZDNSaXg2aXJMMjFJSGEwYjN6c1hzZHpHU0R2K3hqL2Q2S0l4Ckdrd2FhYmZvU1NoQnFqaFNlQ0VyZXFlb1RpYjljdGw0MGRVdUp3THl4bjhHS2N6K3AvMEJUOEIxU3lYK01OQ2wKY0pkMjVtMjhLajY2TGUxOEVyeFlJYXZJVGVGa3Y2eGZjdkEvcHladDdPaU41QTlGQk1IUmpQK1kyZ2tvdjMrcQpISFRUZG4xNnlRajduNit3YlFHNGVleXc0YisyQkRLcUxNVFU2ZmlSQ3ZPM2FPZVBLSFVNN3R4b1FidWl6Z3NzCkNiMzl3QnJOTEZsMkJLQ1RkSCtkSU9oZVJiSkZvbmlwOGRPOUVFZWdSSG9lQW54ZUlYTFBrdXMzTzEvZjRhNkIKWHQ3RG5BUm8xSzJmeEp3VXRaU2MvR3dFSjU5NzlnRXlEa3pDZEVsLzdpWE9QZXVjTXhlM2xVM2pweUtsNERUaApjSkJqQytqNGpLWTFrK1U4b040aGdqYnJISUx6Vnd2eU15OU5KS290U3BMSjQxeHdPOHlGangxalFTT3Bxc0N1ClFhUFUvTjhSZ0hxWjBGTkFzS3dNUmZ6WmdXanRCNzRzYUVEdk5jVmNuNFhCQnFNSG0ydHo2Uzk3d3kxZGt0cTgKSE5BPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==")))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksCreateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksCreateSamples.java new file mode 100644 index 0000000000000..7c59126c91855 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksCreateSamples.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.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.models.WebhookAction; +import com.azure.resourcemanager.containerregistry.models.WebhookCreateParameters; +import com.azure.resourcemanager.containerregistry.models.WebhookStatus; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Webhooks Create. */ +public final class WebhooksCreateSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/WebhookCreate.json + */ + /** + * Sample code: WebhookCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void webhookCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getWebhooks() + .create( + "myResourceGroup", + "myRegistry", + "myWebhook", + new WebhookCreateParameters() + .withTags(mapOf("key", "value")) + .withLocation("westus") + .withServiceUri("http://myservice.com") + .withCustomHeaders( + mapOf("Authorization", "Basic 000000000000000000000000000000000000000000000000000")) + .withStatus(WebhookStatus.ENABLED) + .withScope("myRepository") + .withActions(Arrays.asList(WebhookAction.PUSH)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksDeleteSamples.java new file mode 100644 index 0000000000000..475766f6f3089 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Webhooks Delete. */ +public final class WebhooksDeleteSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/WebhookDelete.json + */ + /** + * Sample code: WebhookDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void webhookDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getWebhooks() + .delete("myResourceGroup", "myRegistry", "myWebhook", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksGetCallbackConfigSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksGetCallbackConfigSamples.java new file mode 100644 index 0000000000000..8d7994c9dbbe6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksGetCallbackConfigSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Webhooks GetCallbackConfig. */ +public final class WebhooksGetCallbackConfigSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/WebhookGetCallbackConfig.json + */ + /** + * Sample code: WebhookGetCallbackConfig. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void webhookGetCallbackConfig(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getWebhooks() + .getCallbackConfigWithResponse("myResourceGroup", "myRegistry", "myWebhook", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksGetSamples.java new file mode 100644 index 0000000000000..52a03afdd4e5e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Webhooks Get. */ +public final class WebhooksGetSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/WebhookGet.json + */ + /** + * Sample code: WebhookGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void webhookGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getWebhooks() + .getWithResponse("myResourceGroup", "myRegistry", "myWebhook", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksListEventsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksListEventsSamples.java new file mode 100644 index 0000000000000..0b995bb2d9240 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksListEventsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Webhooks ListEvents. */ +public final class WebhooksListEventsSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/WebhookListEvents.json + */ + /** + * Sample code: WebhookListEvents. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void webhookListEvents(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getWebhooks() + .listEvents("myResourceGroup", "myRegistry", "myWebhook", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksListSamples.java new file mode 100644 index 0000000000000..0ce942622700d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Webhooks List. */ +public final class WebhooksListSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/WebhookList.json + */ + /** + * Sample code: WebhookList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void webhookList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getWebhooks() + .list("myResourceGroup", "myRegistry", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksPingSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksPingSamples.java new file mode 100644 index 0000000000000..83b526064af08 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksPingSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; + +/** Samples for Webhooks Ping. */ +public final class WebhooksPingSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/WebhookPing.json + */ + /** + * Sample code: WebhookPing. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void webhookPing(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getWebhooks() + .pingWithResponse("myResourceGroup", "myRegistry", "myWebhook", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksUpdateSamples.java new file mode 100644 index 0000000000000..c3a00c56fc886 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerregistry/generated/WebhooksUpdateSamples.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerregistry.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.models.WebhookAction; +import com.azure.resourcemanager.containerregistry.models.WebhookStatus; +import com.azure.resourcemanager.containerregistry.models.WebhookUpdateParameters; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Webhooks Update. */ +public final class WebhooksUpdateSamples { + /* + * x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/preview/2019-12-01-preview/examples/WebhookUpdate.json + */ + /** + * Sample code: WebhookUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void webhookUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .containerRegistries() + .manager() + .serviceClient() + .getWebhooks() + .update( + "myResourceGroup", + "myRegistry", + "myWebhook", + new WebhookUpdateParameters() + .withTags(mapOf("key", "value")) + .withServiceUri("http://myservice.com") + .withCustomHeaders( + mapOf("Authorization", "Basic 000000000000000000000000000000000000000000000000000")) + .withStatus(WebhookStatus.ENABLED) + .withScope("myRepository") + .withActions(Arrays.asList(WebhookAction.PUSH)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/AgentPoolsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/AgentPoolsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..b1cd77c420bd6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/AgentPoolsCreateOrUpdateSamples.java @@ -0,0 +1,521 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner; +import com.azure.resourcemanager.containerservice.models.AgentPoolMode; +import com.azure.resourcemanager.containerservice.models.Code; +import com.azure.resourcemanager.containerservice.models.CreationData; +import com.azure.resourcemanager.containerservice.models.GpuInstanceProfile; +import com.azure.resourcemanager.containerservice.models.KubeletConfig; +import com.azure.resourcemanager.containerservice.models.LinuxOSConfig; +import com.azure.resourcemanager.containerservice.models.OSDiskType; +import com.azure.resourcemanager.containerservice.models.OSType; +import com.azure.resourcemanager.containerservice.models.Ossku; +import com.azure.resourcemanager.containerservice.models.PowerState; +import com.azure.resourcemanager.containerservice.models.ScaleSetEvictionPolicy; +import com.azure.resourcemanager.containerservice.models.ScaleSetPriority; +import com.azure.resourcemanager.containerservice.models.SysctlConfig; +import com.azure.resourcemanager.containerservice.models.WorkloadRuntime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AgentPools CreateOrUpdate. */ +public final class AgentPoolsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/AgentPoolsCreate_EnableFIPS.json + */ + /** + * Sample code: Create Agent Pool with FIPS enabled OS. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAgentPoolWithFIPSEnabledOS(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getAgentPools() + .createOrUpdate( + "rg1", + "clustername1", + "agentpool1", + new AgentPoolInner() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withOrchestratorVersion("") + .withEnableFips(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/AgentPools_Update.json + */ + /** + * Sample code: Update Agent Pool. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateAgentPool(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getAgentPools() + .createOrUpdate( + "rg1", + "clustername1", + "agentpool1", + new AgentPoolInner() + .withCount(3) + .withVmSize("Standard_DS1_v2") + .withOsType(OSType.LINUX) + .withMaxCount(2) + .withMinCount(2) + .withEnableAutoScaling(true) + .withOrchestratorVersion("") + .withScaleSetPriority(ScaleSetPriority.SPOT) + .withScaleSetEvictionPolicy(ScaleSetEvictionPolicy.DELETE) + .withNodeTaints(Arrays.asList("Key1=Value1:NoSchedule")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/AgentPoolsCreate_GPUMIG.json + */ + /** + * Sample code: Create Agent Pool with GPUMIG. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAgentPoolWithGPUMIG(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getAgentPools() + .createOrUpdate( + "rg1", + "clustername1", + "agentpool1", + new AgentPoolInner() + .withCount(3) + .withVmSize("Standard_ND96asr_v4") + .withOsType(OSType.LINUX) + .withOrchestratorVersion("") + .withKubeletConfig( + new KubeletConfig() + .withCpuManagerPolicy("static") + .withCpuCfsQuota(true) + .withCpuCfsQuotaPeriod("200ms") + .withImageGcHighThreshold(90) + .withImageGcLowThreshold(70) + .withTopologyManagerPolicy("best-effort") + .withAllowedUnsafeSysctls(Arrays.asList("kernel.msg*", "net.core.somaxconn")) + .withFailSwapOn(false)) + .withLinuxOSConfig( + new LinuxOSConfig() + .withSysctls( + new SysctlConfig() + .withNetCoreWmemDefault(12345) + .withNetIpv4TcpTwReuse(true) + .withNetIpv4IpLocalPortRange("20000 60000") + .withKernelThreadsMax(99999)) + .withTransparentHugePageEnabled("always") + .withTransparentHugePageDefrag("madvise") + .withSwapFileSizeMB(1500)) + .withGpuInstanceProfile(GpuInstanceProfile.MIG2G), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/AgentPoolsCreate_Update.json + */ + /** + * Sample code: Create/Update Agent Pool. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createUpdateAgentPool(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getAgentPools() + .createOrUpdate( + "rg1", + "clustername1", + "agentpool1", + new AgentPoolInner() + .withCount(3) + .withVmSize("Standard_DS1_v2") + .withOsType(OSType.LINUX) + .withMode(AgentPoolMode.USER) + .withOrchestratorVersion("") + .withScaleSetPriority(ScaleSetPriority.SPOT) + .withScaleSetEvictionPolicy(ScaleSetEvictionPolicy.DELETE) + .withTags(mapOf("name1", "val1")) + .withNodeLabels(mapOf("key1", "val1")) + .withNodeTaints(Arrays.asList("Key1=Value1:NoSchedule")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/AgentPools_Start.json + */ + /** + * Sample code: Start Agent Pool. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void startAgentPool(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getAgentPools() + .createOrUpdate( + "rg1", + "clustername1", + "agentpool1", + new AgentPoolInner().withPowerState(new PowerState().withCode(Code.RUNNING)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/AgentPoolsCreate_Spot.json + */ + /** + * Sample code: Create Spot Agent Pool. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createSpotAgentPool(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getAgentPools() + .createOrUpdate( + "rg1", + "clustername1", + "agentpool1", + new AgentPoolInner() + .withCount(3) + .withVmSize("Standard_DS1_v2") + .withOsType(OSType.LINUX) + .withOrchestratorVersion("") + .withScaleSetPriority(ScaleSetPriority.SPOT) + .withScaleSetEvictionPolicy(ScaleSetEvictionPolicy.DELETE) + .withTags(mapOf("name1", "val1")) + .withNodeLabels(mapOf("key1", "val1")) + .withNodeTaints(Arrays.asList("Key1=Value1:NoSchedule")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/AgentPoolsCreate_Ephemeral.json + */ + /** + * Sample code: Create Agent Pool with Ephemeral OS Disk. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAgentPoolWithEphemeralOSDisk(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getAgentPools() + .createOrUpdate( + "rg1", + "clustername1", + "agentpool1", + new AgentPoolInner() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsDiskSizeGB(64) + .withOsDiskType(OSDiskType.EPHEMERAL) + .withOsType(OSType.LINUX) + .withOrchestratorVersion(""), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/AgentPoolsCreate_EnableEncryptionAtHost.json + */ + /** + * Sample code: Create Agent Pool with EncryptionAtHost enabled. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAgentPoolWithEncryptionAtHostEnabled( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getAgentPools() + .createOrUpdate( + "rg1", + "clustername1", + "agentpool1", + new AgentPoolInner() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withOrchestratorVersion("") + .withEnableEncryptionAtHost(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/AgentPoolsCreate_EnableUltraSSD.json + */ + /** + * Sample code: Create Agent Pool with UltraSSD enabled. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAgentPoolWithUltraSSDEnabled(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getAgentPools() + .createOrUpdate( + "rg1", + "clustername1", + "agentpool1", + new AgentPoolInner() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withOrchestratorVersion("") + .withEnableUltraSsd(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/AgentPoolsCreate_WasmWasi.json + */ + /** + * Sample code: Create Agent Pool with Krustlet and the WASI runtime. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAgentPoolWithKrustletAndTheWASIRuntime( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getAgentPools() + .createOrUpdate( + "rg1", + "clustername1", + "agentpool1", + new AgentPoolInner() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsDiskSizeGB(64) + .withWorkloadRuntime(WorkloadRuntime.WASM_WASI) + .withOsType(OSType.LINUX) + .withMode(AgentPoolMode.USER) + .withOrchestratorVersion(""), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/AgentPoolsCreate_Snapshot.json + */ + /** + * Sample code: Create Agent Pool using an agent pool snapshot. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAgentPoolUsingAnAgentPoolSnapshot(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getAgentPools() + .createOrUpdate( + "rg1", + "clustername1", + "agentpool1", + new AgentPoolInner() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withOrchestratorVersion("") + .withEnableFips(true) + .withCreationData( + new CreationData() + .withSourceResourceId( + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/AgentPoolsCreate_PPG.json + */ + /** + * Sample code: Create Agent Pool with PPG. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAgentPoolWithPPG(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getAgentPools() + .createOrUpdate( + "rg1", + "clustername1", + "agentpool1", + new AgentPoolInner() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withOrchestratorVersion("") + .withProximityPlacementGroupId( + "/subscriptions/subid1/resourcegroups/rg1/providers//Microsoft.Compute/proximityPlacementGroups/ppg1"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/AgentPoolsCreate_CustomNodeConfig.json + */ + /** + * Sample code: Create Agent Pool with KubeletConfig and LinuxOSConfig. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAgentPoolWithKubeletConfigAndLinuxOSConfig( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getAgentPools() + .createOrUpdate( + "rg1", + "clustername1", + "agentpool1", + new AgentPoolInner() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withOrchestratorVersion("") + .withKubeletConfig( + new KubeletConfig() + .withCpuManagerPolicy("static") + .withCpuCfsQuota(true) + .withCpuCfsQuotaPeriod("200ms") + .withImageGcHighThreshold(90) + .withImageGcLowThreshold(70) + .withTopologyManagerPolicy("best-effort") + .withAllowedUnsafeSysctls(Arrays.asList("kernel.msg*", "net.core.somaxconn")) + .withFailSwapOn(false)) + .withLinuxOSConfig( + new LinuxOSConfig() + .withSysctls( + new SysctlConfig() + .withNetCoreWmemDefault(12345) + .withNetIpv4TcpTwReuse(true) + .withNetIpv4IpLocalPortRange("20000 60000") + .withKernelThreadsMax(99999)) + .withTransparentHugePageEnabled("always") + .withTransparentHugePageDefrag("madvise") + .withSwapFileSizeMB(1500)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/AgentPools_Stop.json + */ + /** + * Sample code: Stop Agent Pool. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void stopAgentPool(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getAgentPools() + .createOrUpdate( + "rg1", + "clustername1", + "agentpool1", + new AgentPoolInner().withPowerState(new PowerState().withCode(Code.STOPPED)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/AgentPoolsCreate_OSSKU.json + */ + /** + * Sample code: Create Agent Pool with OSSKU. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAgentPoolWithOSSKU(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getAgentPools() + .createOrUpdate( + "rg1", + "clustername1", + "agentpool1", + new AgentPoolInner() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withOsSku(Ossku.CBLMARINER) + .withOrchestratorVersion("") + .withKubeletConfig( + new KubeletConfig() + .withCpuManagerPolicy("static") + .withCpuCfsQuota(true) + .withCpuCfsQuotaPeriod("200ms") + .withImageGcHighThreshold(90) + .withImageGcLowThreshold(70) + .withTopologyManagerPolicy("best-effort") + .withAllowedUnsafeSysctls(Arrays.asList("kernel.msg*", "net.core.somaxconn")) + .withFailSwapOn(false)) + .withLinuxOSConfig( + new LinuxOSConfig() + .withSysctls( + new SysctlConfig() + .withNetCoreWmemDefault(12345) + .withNetIpv4TcpTwReuse(true) + .withNetIpv4IpLocalPortRange("20000 60000") + .withKernelThreadsMax(99999)) + .withTransparentHugePageEnabled("always") + .withTransparentHugePageDefrag("madvise") + .withSwapFileSizeMB(1500)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/AgentPoolsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/AgentPoolsDeleteSamples.java new file mode 100644 index 0000000000000..19caff7c9b054 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/AgentPoolsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for AgentPools Delete. */ +public final class AgentPoolsDeleteSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/AgentPoolsDelete.json + */ + /** + * Sample code: Delete Agent Pool. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteAgentPool(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getAgentPools() + .delete("rg1", "clustername1", "agentpool1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/AgentPoolsGetAvailableAgentPoolVersionsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/AgentPoolsGetAvailableAgentPoolVersionsSamples.java new file mode 100644 index 0000000000000..0ff4099fd2aaa --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/AgentPoolsGetAvailableAgentPoolVersionsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for AgentPools GetAvailableAgentPoolVersions. */ +public final class AgentPoolsGetAvailableAgentPoolVersionsSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/AgentPoolsGetAgentPoolAvailableVersions.json + */ + /** + * Sample code: Get available versions for agent pool. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAvailableVersionsForAgentPool(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getAgentPools() + .getAvailableAgentPoolVersionsWithResponse("rg1", "clustername1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/AgentPoolsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/AgentPoolsGetSamples.java new file mode 100644 index 0000000000000..170f5f71b4898 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/AgentPoolsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for AgentPools Get. */ +public final class AgentPoolsGetSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/AgentPoolsGet.json + */ + /** + * Sample code: Get Agent Pool. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAgentPool(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getAgentPools() + .getWithResponse("rg1", "clustername1", "agentpool1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/AgentPoolsGetUpgradeProfileSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/AgentPoolsGetUpgradeProfileSamples.java new file mode 100644 index 0000000000000..7b40ee3fc4987 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/AgentPoolsGetUpgradeProfileSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for AgentPools GetUpgradeProfile. */ +public final class AgentPoolsGetUpgradeProfileSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/AgentPoolsGetUpgradeProfile.json + */ + /** + * Sample code: Get Upgrade Profile for Agent Pool. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getUpgradeProfileForAgentPool(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getAgentPools() + .getUpgradeProfileWithResponse("rg1", "clustername1", "agentpool1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/AgentPoolsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/AgentPoolsListSamples.java new file mode 100644 index 0000000000000..40dafe7102aed --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/AgentPoolsListSamples.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.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for AgentPools List. */ +public final class AgentPoolsListSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/AgentPoolsList.json + */ + /** + * Sample code: List Agent Pools by Managed Cluster. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAgentPoolsByManagedCluster(com.azure.resourcemanager.AzureResourceManager azure) { + azure.kubernetesClusters().manager().serviceClient().getAgentPools().list("rg1", "clustername1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/AgentPoolsUpgradeNodeImageVersionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/AgentPoolsUpgradeNodeImageVersionSamples.java new file mode 100644 index 0000000000000..43a1a2a02791f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/AgentPoolsUpgradeNodeImageVersionSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for AgentPools UpgradeNodeImageVersion. */ +public final class AgentPoolsUpgradeNodeImageVersionSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/AgentPoolsUpgradeNodeImageVersion.json + */ + /** + * Sample code: Upgrade Agent Pool Node Image Version. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void upgradeAgentPoolNodeImageVersion(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getAgentPools() + .upgradeNodeImageVersion("rg1", "clustername1", "agentpool1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ContainerServicesListOrchestratorsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ContainerServicesListOrchestratorsSamples.java new file mode 100644 index 0000000000000..9861807ecc2f7 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ContainerServicesListOrchestratorsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for ContainerServices ListOrchestrators. */ +public final class ContainerServicesListOrchestratorsSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2019-08-01/examples/ContainerServiceListOrchestrators.json + */ + /** + * Sample code: List Container Service Orchestrators. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listContainerServiceOrchestrators(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getContainerServices() + .listOrchestratorsWithResponse("location1", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/MaintenanceConfigurationsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/MaintenanceConfigurationsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..bfb145d09124f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/MaintenanceConfigurationsCreateOrUpdateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerservice.fluent.models.MaintenanceConfigurationInner; +import com.azure.resourcemanager.containerservice.models.TimeInWeek; +import com.azure.resourcemanager.containerservice.models.TimeSpan; +import com.azure.resourcemanager.containerservice.models.WeekDay; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for MaintenanceConfigurations CreateOrUpdate. */ +public final class MaintenanceConfigurationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/MaintenanceConfigurationsCreate_Update.json + */ + /** + * Sample code: Create/Update Maintenance Configuration. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createUpdateMaintenanceConfiguration(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getMaintenanceConfigurations() + .createOrUpdateWithResponse( + "rg1", + "clustername1", + "default", + new MaintenanceConfigurationInner() + .withTimeInWeek( + Arrays.asList(new TimeInWeek().withDay(WeekDay.MONDAY).withHourSlots(Arrays.asList(1, 2)))) + .withNotAllowedTime( + Arrays + .asList( + new TimeSpan() + .withStart(OffsetDateTime.parse("2020-11-26T03:00:00Z")) + .withEnd(OffsetDateTime.parse("2020-11-30T12:00:00Z")))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/MaintenanceConfigurationsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/MaintenanceConfigurationsDeleteSamples.java new file mode 100644 index 0000000000000..ba7ee5703fb3c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/MaintenanceConfigurationsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for MaintenanceConfigurations Delete. */ +public final class MaintenanceConfigurationsDeleteSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/MaintenanceConfigurationsDelete.json + */ + /** + * Sample code: Delete Maintenance Configuration. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteMaintenanceConfiguration(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getMaintenanceConfigurations() + .deleteWithResponse("rg1", "clustername1", "default", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/MaintenanceConfigurationsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/MaintenanceConfigurationsGetSamples.java new file mode 100644 index 0000000000000..b3be0bba253fb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/MaintenanceConfigurationsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for MaintenanceConfigurations Get. */ +public final class MaintenanceConfigurationsGetSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/MaintenanceConfigurationsGet.json + */ + /** + * Sample code: Get Maintenance Configuration. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getMaintenanceConfiguration(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getMaintenanceConfigurations() + .getWithResponse("rg1", "clustername1", "default", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/MaintenanceConfigurationsListByManagedClusterSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/MaintenanceConfigurationsListByManagedClusterSamples.java new file mode 100644 index 0000000000000..a9e8ac8d109ec --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/MaintenanceConfigurationsListByManagedClusterSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for MaintenanceConfigurations ListByManagedCluster. */ +public final class MaintenanceConfigurationsListByManagedClusterSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/MaintenanceConfigurationsList.json + */ + /** + * Sample code: List maintenance configurations by Managed Cluster. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listMaintenanceConfigurationsByManagedCluster( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getMaintenanceConfigurations() + .listByManagedCluster("rg1", "clustername1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..19fd025947cf4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersCreateOrUpdateSamples.java @@ -0,0 +1,1537 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerservice.fluent.models.ManagedClusterInner; +import com.azure.resourcemanager.containerservice.models.AgentPoolMode; +import com.azure.resourcemanager.containerservice.models.AgentPoolType; +import com.azure.resourcemanager.containerservice.models.ContainerServiceLinuxProfile; +import com.azure.resourcemanager.containerservice.models.ContainerServiceNetworkProfile; +import com.azure.resourcemanager.containerservice.models.ContainerServiceSshConfiguration; +import com.azure.resourcemanager.containerservice.models.ContainerServiceSshPublicKey; +import com.azure.resourcemanager.containerservice.models.CreationData; +import com.azure.resourcemanager.containerservice.models.Expander; +import com.azure.resourcemanager.containerservice.models.GpuInstanceProfile; +import com.azure.resourcemanager.containerservice.models.LicenseType; +import com.azure.resourcemanager.containerservice.models.LoadBalancerSku; +import com.azure.resourcemanager.containerservice.models.ManagedClusterAadProfile; +import com.azure.resourcemanager.containerservice.models.ManagedClusterAgentPoolProfile; +import com.azure.resourcemanager.containerservice.models.ManagedClusterApiServerAccessProfile; +import com.azure.resourcemanager.containerservice.models.ManagedClusterHttpProxyConfig; +import com.azure.resourcemanager.containerservice.models.ManagedClusterIdentity; +import com.azure.resourcemanager.containerservice.models.ManagedClusterLoadBalancerProfile; +import com.azure.resourcemanager.containerservice.models.ManagedClusterLoadBalancerProfileManagedOutboundIPs; +import com.azure.resourcemanager.containerservice.models.ManagedClusterManagedOutboundIpProfile; +import com.azure.resourcemanager.containerservice.models.ManagedClusterNatGatewayProfile; +import com.azure.resourcemanager.containerservice.models.ManagedClusterPodIdentityProfile; +import com.azure.resourcemanager.containerservice.models.ManagedClusterPropertiesAutoScalerProfile; +import com.azure.resourcemanager.containerservice.models.ManagedClusterSecurityProfile; +import com.azure.resourcemanager.containerservice.models.ManagedClusterSecurityProfileAzureDefender; +import com.azure.resourcemanager.containerservice.models.ManagedClusterServicePrincipalProfile; +import com.azure.resourcemanager.containerservice.models.ManagedClusterSku; +import com.azure.resourcemanager.containerservice.models.ManagedClusterSkuName; +import com.azure.resourcemanager.containerservice.models.ManagedClusterSkuTier; +import com.azure.resourcemanager.containerservice.models.ManagedClusterWindowsProfile; +import com.azure.resourcemanager.containerservice.models.ManagedServiceIdentityUserAssignedIdentitiesValue; +import com.azure.resourcemanager.containerservice.models.OSType; +import com.azure.resourcemanager.containerservice.models.Ossku; +import com.azure.resourcemanager.containerservice.models.OutboundType; +import com.azure.resourcemanager.containerservice.models.ResourceIdentityType; +import com.azure.resourcemanager.containerservice.models.ScaleDownMode; +import com.azure.resourcemanager.containerservice.models.WindowsGmsaProfile; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ManagedClusters CreateOrUpdate. */ +public final class ManagedClustersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersCreate_HTTPProxy.json + */ + /** + * Sample code: Create Managed Cluster with HTTP proxy configured. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createManagedClusterWithHTTPProxyConfigured( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .createOrUpdate( + "rg1", + "clustername1", + new ManagedClusterInner() + .withLocation("location1") + .withTags(mapOf("archv2", "", "tier", "production")) + .withSku( + new ManagedClusterSku() + .withName(ManagedClusterSkuName.BASIC) + .withTier(ManagedClusterSkuTier.FREE)) + .withKubernetesVersion("") + .withDnsPrefix("dnsprefix1") + .withAgentPoolProfiles( + Arrays + .asList( + new ManagedClusterAgentPoolProfile() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withType(AgentPoolType.VIRTUAL_MACHINE_SCALE_SETS) + .withMode(AgentPoolMode.SYSTEM) + .withEnableNodePublicIp(true) + .withName("nodepool1"))) + .withLinuxProfile( + new ContainerServiceLinuxProfile() + .withAdminUsername("azureuser") + .withSsh( + new ContainerServiceSshConfiguration() + .withPublicKeys( + Arrays.asList(new ContainerServiceSshPublicKey().withKeyData("keydata"))))) + .withWindowsProfile( + new ManagedClusterWindowsProfile() + .withAdminUsername("azureuser") + .withAdminPassword("replacePassword1234$")) + .withServicePrincipalProfile( + new ManagedClusterServicePrincipalProfile().withClientId("clientid").withSecret("secret")) + .withAddonProfiles(mapOf()) + .withEnableRbac(true) + .withEnablePodSecurityPolicy(true) + .withNetworkProfile( + new ContainerServiceNetworkProfile() + .withOutboundType(OutboundType.LOAD_BALANCER) + .withLoadBalancerSku(LoadBalancerSku.STANDARD) + .withLoadBalancerProfile( + new ManagedClusterLoadBalancerProfile() + .withManagedOutboundIPs( + new ManagedClusterLoadBalancerProfileManagedOutboundIPs().withCount(2)))) + .withAutoScalerProfile( + new ManagedClusterPropertiesAutoScalerProfile() + .withScanInterval("20s") + .withScaleDownDelayAfterAdd("15m")) + .withDiskEncryptionSetId( + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des") + .withHttpProxyConfig( + new ManagedClusterHttpProxyConfig() + .withHttpProxy("http://myproxy.server.com:8080") + .withHttpsProxy("https://myproxy.server.com:8080") + .withNoProxy(Arrays.asList("localhost", "127.0.0.1")) + .withTrustedCa("Q29uZ3JhdHMhIFlvdSBoYXZlIGZvdW5kIGEgaGlkZGVuIG1lc3NhZ2U=")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersCreate_EnabledFIPS.json + */ + /** + * Sample code: Create Managed Cluster with FIPS enabled OS. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createManagedClusterWithFIPSEnabledOS(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .createOrUpdate( + "rg1", + "clustername1", + new ManagedClusterInner() + .withLocation("location1") + .withTags(mapOf("archv2", "", "tier", "production")) + .withSku( + new ManagedClusterSku() + .withName(ManagedClusterSkuName.BASIC) + .withTier(ManagedClusterSkuTier.FREE)) + .withKubernetesVersion("") + .withDnsPrefix("dnsprefix1") + .withAgentPoolProfiles( + Arrays + .asList( + new ManagedClusterAgentPoolProfile() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withType(AgentPoolType.VIRTUAL_MACHINE_SCALE_SETS) + .withMode(AgentPoolMode.SYSTEM) + .withEnableNodePublicIp(true) + .withEnableFips(true) + .withName("nodepool1"))) + .withLinuxProfile( + new ContainerServiceLinuxProfile() + .withAdminUsername("azureuser") + .withSsh( + new ContainerServiceSshConfiguration() + .withPublicKeys( + Arrays.asList(new ContainerServiceSshPublicKey().withKeyData("keydata"))))) + .withWindowsProfile( + new ManagedClusterWindowsProfile() + .withAdminUsername("azureuser") + .withAdminPassword("replacePassword1234$")) + .withServicePrincipalProfile( + new ManagedClusterServicePrincipalProfile().withClientId("clientid").withSecret("secret")) + .withAddonProfiles(mapOf()) + .withEnableRbac(true) + .withEnablePodSecurityPolicy(false) + .withNetworkProfile( + new ContainerServiceNetworkProfile() + .withOutboundType(OutboundType.LOAD_BALANCER) + .withLoadBalancerSku(LoadBalancerSku.STANDARD) + .withLoadBalancerProfile( + new ManagedClusterLoadBalancerProfile() + .withManagedOutboundIPs( + new ManagedClusterLoadBalancerProfileManagedOutboundIPs().withCount(2)))) + .withAutoScalerProfile( + new ManagedClusterPropertiesAutoScalerProfile() + .withScanInterval("20s") + .withScaleDownDelayAfterAdd("15m")) + .withDiskEncryptionSetId( + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersCreate_SecurityProfile.json + */ + /** + * Sample code: Create Managed Cluster with Security Profile configured. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createManagedClusterWithSecurityProfileConfigured( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .createOrUpdate( + "rg1", + "clustername1", + new ManagedClusterInner() + .withLocation("location1") + .withTags(mapOf("archv2", "", "tier", "production")) + .withSku( + new ManagedClusterSku() + .withName(ManagedClusterSkuName.BASIC) + .withTier(ManagedClusterSkuTier.FREE)) + .withKubernetesVersion("") + .withDnsPrefix("dnsprefix1") + .withAgentPoolProfiles( + Arrays + .asList( + new ManagedClusterAgentPoolProfile() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withType(AgentPoolType.VIRTUAL_MACHINE_SCALE_SETS) + .withMode(AgentPoolMode.SYSTEM) + .withEnableNodePublicIp(true) + .withName("nodepool1"))) + .withLinuxProfile( + new ContainerServiceLinuxProfile() + .withAdminUsername("azureuser") + .withSsh( + new ContainerServiceSshConfiguration() + .withPublicKeys( + Arrays.asList(new ContainerServiceSshPublicKey().withKeyData("keydata"))))) + .withNetworkProfile( + new ContainerServiceNetworkProfile() + .withOutboundType(OutboundType.LOAD_BALANCER) + .withLoadBalancerSku(LoadBalancerSku.STANDARD) + .withLoadBalancerProfile( + new ManagedClusterLoadBalancerProfile() + .withManagedOutboundIPs( + new ManagedClusterLoadBalancerProfileManagedOutboundIPs().withCount(2)))) + .withSecurityProfile( + new ManagedClusterSecurityProfile() + .withAzureDefender( + new ManagedClusterSecurityProfileAzureDefender() + .withEnabled(true) + .withLogAnalyticsWorkspaceResourceId( + "/subscriptions/SUB_ID/resourcegroups/RG_NAME/providers/microsoft.operationalinsights/workspaces/WORKSPACE_NAME"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersCreate_PPG.json + */ + /** + * Sample code: Create Managed Cluster with PPG. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createManagedClusterWithPPG(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .createOrUpdate( + "rg1", + "clustername1", + new ManagedClusterInner() + .withLocation("location1") + .withTags(mapOf("archv2", "", "tier", "production")) + .withSku( + new ManagedClusterSku() + .withName(ManagedClusterSkuName.BASIC) + .withTier(ManagedClusterSkuTier.FREE)) + .withKubernetesVersion("") + .withDnsPrefix("dnsprefix1") + .withAgentPoolProfiles( + Arrays + .asList( + new ManagedClusterAgentPoolProfile() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withType(AgentPoolType.VIRTUAL_MACHINE_SCALE_SETS) + .withMode(AgentPoolMode.SYSTEM) + .withEnableNodePublicIp(true) + .withProximityPlacementGroupId( + "/subscriptions/subid1/resourcegroups/rg1/providers//Microsoft.Compute/proximityPlacementGroups/ppg1") + .withName("nodepool1"))) + .withLinuxProfile( + new ContainerServiceLinuxProfile() + .withAdminUsername("azureuser") + .withSsh( + new ContainerServiceSshConfiguration() + .withPublicKeys( + Arrays.asList(new ContainerServiceSshPublicKey().withKeyData("keydata"))))) + .withWindowsProfile( + new ManagedClusterWindowsProfile() + .withAdminUsername("azureuser") + .withAdminPassword("replacePassword1234$")) + .withServicePrincipalProfile( + new ManagedClusterServicePrincipalProfile().withClientId("clientid").withSecret("secret")) + .withAddonProfiles(mapOf()) + .withEnableRbac(true) + .withEnablePodSecurityPolicy(true) + .withNetworkProfile( + new ContainerServiceNetworkProfile() + .withOutboundType(OutboundType.LOAD_BALANCER) + .withLoadBalancerSku(LoadBalancerSku.STANDARD) + .withLoadBalancerProfile( + new ManagedClusterLoadBalancerProfile() + .withManagedOutboundIPs( + new ManagedClusterLoadBalancerProfileManagedOutboundIPs().withCount(2)))) + .withAutoScalerProfile( + new ManagedClusterPropertiesAutoScalerProfile() + .withScanInterval("20s") + .withScaleDownDelayAfterAdd("15m")) + .withDiskEncryptionSetId( + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersCreate_UpdateWithAHUB.json + */ + /** + * Sample code: Create/Update Managed Cluster with EnableAHUB. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createUpdateManagedClusterWithEnableAHUB(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .createOrUpdate( + "rg1", + "clustername1", + new ManagedClusterInner() + .withLocation("location1") + .withTags(mapOf("archv2", "", "tier", "production")) + .withSku( + new ManagedClusterSku() + .withName(ManagedClusterSkuName.BASIC) + .withTier(ManagedClusterSkuTier.FREE)) + .withIdentity( + new ManagedClusterIdentity() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/subid1/resourceGroups/rgName1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1", + new ManagedServiceIdentityUserAssignedIdentitiesValue()))) + .withKubernetesVersion("") + .withDnsPrefix("dnsprefix1") + .withAgentPoolProfiles( + Arrays + .asList( + new ManagedClusterAgentPoolProfile() + .withCount(3) + .withVmSize("Standard_DS1_v2") + .withOsType(OSType.LINUX) + .withType(AgentPoolType.VIRTUAL_MACHINE_SCALE_SETS) + .withMode(AgentPoolMode.SYSTEM) + .withAvailabilityZones(Arrays.asList("1", "2", "3")) + .withEnableNodePublicIp(true) + .withName("nodepool1"))) + .withLinuxProfile( + new ContainerServiceLinuxProfile() + .withAdminUsername("azureuser") + .withSsh( + new ContainerServiceSshConfiguration() + .withPublicKeys( + Arrays.asList(new ContainerServiceSshPublicKey().withKeyData("keydata"))))) + .withWindowsProfile( + new ManagedClusterWindowsProfile() + .withAdminUsername("azureuser") + .withAdminPassword("replacePassword1234$") + .withLicenseType(LicenseType.WINDOWS_SERVER)) + .withServicePrincipalProfile( + new ManagedClusterServicePrincipalProfile().withClientId("clientid").withSecret("secret")) + .withAddonProfiles(mapOf()) + .withEnableRbac(true) + .withEnablePodSecurityPolicy(true) + .withNetworkProfile( + new ContainerServiceNetworkProfile() + .withOutboundType(OutboundType.LOAD_BALANCER) + .withLoadBalancerSku(LoadBalancerSku.STANDARD) + .withLoadBalancerProfile( + new ManagedClusterLoadBalancerProfile() + .withManagedOutboundIPs( + new ManagedClusterLoadBalancerProfileManagedOutboundIPs().withCount(2)))) + .withAutoScalerProfile( + new ManagedClusterPropertiesAutoScalerProfile() + .withScanInterval("20s") + .withScaleDownDelayAfterAdd("15m")) + .withDiskEncryptionSetId( + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersCreate_PodIdentity.json + */ + /** + * Sample code: Create Managed Cluster with PodIdentity enabled. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createManagedClusterWithPodIdentityEnabled( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .createOrUpdate( + "rg1", + "clustername1", + new ManagedClusterInner() + .withLocation("location1") + .withTags(mapOf("archv2", "", "tier", "production")) + .withSku( + new ManagedClusterSku() + .withName(ManagedClusterSkuName.BASIC) + .withTier(ManagedClusterSkuTier.FREE)) + .withKubernetesVersion("") + .withDnsPrefix("dnsprefix1") + .withAgentPoolProfiles( + Arrays + .asList( + new ManagedClusterAgentPoolProfile() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withType(AgentPoolType.VIRTUAL_MACHINE_SCALE_SETS) + .withMode(AgentPoolMode.SYSTEM) + .withEnableNodePublicIp(true) + .withName("nodepool1"))) + .withLinuxProfile( + new ContainerServiceLinuxProfile() + .withAdminUsername("azureuser") + .withSsh( + new ContainerServiceSshConfiguration() + .withPublicKeys( + Arrays.asList(new ContainerServiceSshPublicKey().withKeyData("keydata"))))) + .withWindowsProfile( + new ManagedClusterWindowsProfile() + .withAdminUsername("azureuser") + .withAdminPassword("replacePassword1234$")) + .withServicePrincipalProfile( + new ManagedClusterServicePrincipalProfile().withClientId("clientid").withSecret("secret")) + .withAddonProfiles(mapOf()) + .withPodIdentityProfile( + new ManagedClusterPodIdentityProfile().withEnabled(true).withAllowNetworkPluginKubenet(true)) + .withEnableRbac(true) + .withEnablePodSecurityPolicy(true) + .withNetworkProfile( + new ContainerServiceNetworkProfile() + .withOutboundType(OutboundType.LOAD_BALANCER) + .withLoadBalancerSku(LoadBalancerSku.STANDARD) + .withLoadBalancerProfile( + new ManagedClusterLoadBalancerProfile() + .withManagedOutboundIPs( + new ManagedClusterLoadBalancerProfileManagedOutboundIPs().withCount(2)))) + .withAutoScalerProfile( + new ManagedClusterPropertiesAutoScalerProfile() + .withScanInterval("20s") + .withScaleDownDelayAfterAdd("15m")) + .withDiskEncryptionSetId( + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersCreate_DisableRunCommand.json + */ + /** + * Sample code: Create Managed Cluster with RunCommand disabled. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createManagedClusterWithRunCommandDisabled( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .createOrUpdate( + "rg1", + "clustername1", + new ManagedClusterInner() + .withLocation("location1") + .withTags(mapOf("archv2", "", "tier", "production")) + .withSku( + new ManagedClusterSku() + .withName(ManagedClusterSkuName.BASIC) + .withTier(ManagedClusterSkuTier.FREE)) + .withKubernetesVersion("") + .withDnsPrefix("dnsprefix1") + .withAgentPoolProfiles( + Arrays + .asList( + new ManagedClusterAgentPoolProfile() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withType(AgentPoolType.VIRTUAL_MACHINE_SCALE_SETS) + .withMode(AgentPoolMode.SYSTEM) + .withEnableNodePublicIp(true) + .withEnableEncryptionAtHost(true) + .withName("nodepool1"))) + .withLinuxProfile( + new ContainerServiceLinuxProfile() + .withAdminUsername("azureuser") + .withSsh( + new ContainerServiceSshConfiguration() + .withPublicKeys( + Arrays.asList(new ContainerServiceSshPublicKey().withKeyData("keydata"))))) + .withWindowsProfile( + new ManagedClusterWindowsProfile() + .withAdminUsername("azureuser") + .withAdminPassword("replacePassword1234$")) + .withServicePrincipalProfile( + new ManagedClusterServicePrincipalProfile().withClientId("clientid").withSecret("secret")) + .withAddonProfiles(mapOf()) + .withEnableRbac(true) + .withEnablePodSecurityPolicy(true) + .withNetworkProfile( + new ContainerServiceNetworkProfile() + .withOutboundType(OutboundType.LOAD_BALANCER) + .withLoadBalancerSku(LoadBalancerSku.STANDARD) + .withLoadBalancerProfile( + new ManagedClusterLoadBalancerProfile() + .withManagedOutboundIPs( + new ManagedClusterLoadBalancerProfileManagedOutboundIPs().withCount(2)))) + .withAutoScalerProfile( + new ManagedClusterPropertiesAutoScalerProfile() + .withScanInterval("20s") + .withScaleDownDelayAfterAdd("15m")) + .withApiServerAccessProfile(new ManagedClusterApiServerAccessProfile().withDisableRunCommand(true)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersCreate_UserAssignedNATGateway.json + */ + /** + * Sample code: Create Managed Cluster with user-assigned NAT gateway as outbound type. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createManagedClusterWithUserAssignedNATGatewayAsOutboundType( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .createOrUpdate( + "rg1", + "clustername1", + new ManagedClusterInner() + .withLocation("location1") + .withTags(mapOf("archv2", "", "tier", "production")) + .withSku( + new ManagedClusterSku() + .withName(ManagedClusterSkuName.BASIC) + .withTier(ManagedClusterSkuTier.FREE)) + .withKubernetesVersion("") + .withDnsPrefix("dnsprefix1") + .withAgentPoolProfiles( + Arrays + .asList( + new ManagedClusterAgentPoolProfile() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withType(AgentPoolType.VIRTUAL_MACHINE_SCALE_SETS) + .withMode(AgentPoolMode.SYSTEM) + .withEnableNodePublicIp(false) + .withName("nodepool1"))) + .withLinuxProfile( + new ContainerServiceLinuxProfile() + .withAdminUsername("azureuser") + .withSsh( + new ContainerServiceSshConfiguration() + .withPublicKeys( + Arrays.asList(new ContainerServiceSshPublicKey().withKeyData("keydata"))))) + .withWindowsProfile( + new ManagedClusterWindowsProfile() + .withAdminUsername("azureuser") + .withAdminPassword("replacePassword1234$")) + .withServicePrincipalProfile( + new ManagedClusterServicePrincipalProfile().withClientId("clientid").withSecret("secret")) + .withAddonProfiles(mapOf()) + .withEnableRbac(true) + .withEnablePodSecurityPolicy(true) + .withNetworkProfile( + new ContainerServiceNetworkProfile() + .withOutboundType(OutboundType.USER_ASSIGNED_NATGATEWAY) + .withLoadBalancerSku(LoadBalancerSku.STANDARD)) + .withAutoScalerProfile( + new ManagedClusterPropertiesAutoScalerProfile() + .withScanInterval("20s") + .withScaleDownDelayAfterAdd("15m")) + .withDiskEncryptionSetId( + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersCreate_Snapshot.json + */ + /** + * Sample code: Create Managed Cluster using an agent pool snapshot. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createManagedClusterUsingAnAgentPoolSnapshot( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .createOrUpdate( + "rg1", + "clustername1", + new ManagedClusterInner() + .withLocation("location1") + .withTags(mapOf("archv2", "", "tier", "production")) + .withSku( + new ManagedClusterSku() + .withName(ManagedClusterSkuName.BASIC) + .withTier(ManagedClusterSkuTier.FREE)) + .withKubernetesVersion("") + .withDnsPrefix("dnsprefix1") + .withAgentPoolProfiles( + Arrays + .asList( + new ManagedClusterAgentPoolProfile() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withType(AgentPoolType.VIRTUAL_MACHINE_SCALE_SETS) + .withMode(AgentPoolMode.SYSTEM) + .withEnableNodePublicIp(true) + .withEnableFips(true) + .withCreationData( + new CreationData() + .withSourceResourceId( + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.ContainerService/snapshots/snapshot1")) + .withName("nodepool1"))) + .withLinuxProfile( + new ContainerServiceLinuxProfile() + .withAdminUsername("azureuser") + .withSsh( + new ContainerServiceSshConfiguration() + .withPublicKeys( + Arrays.asList(new ContainerServiceSshPublicKey().withKeyData("keydata"))))) + .withWindowsProfile( + new ManagedClusterWindowsProfile() + .withAdminUsername("azureuser") + .withAdminPassword("replacePassword1234$")) + .withServicePrincipalProfile( + new ManagedClusterServicePrincipalProfile().withClientId("clientid").withSecret("secret")) + .withAddonProfiles(mapOf()) + .withEnableRbac(true) + .withEnablePodSecurityPolicy(false) + .withNetworkProfile( + new ContainerServiceNetworkProfile() + .withOutboundType(OutboundType.LOAD_BALANCER) + .withLoadBalancerSku(LoadBalancerSku.STANDARD) + .withLoadBalancerProfile( + new ManagedClusterLoadBalancerProfile() + .withManagedOutboundIPs( + new ManagedClusterLoadBalancerProfileManagedOutboundIPs().withCount(2)))) + .withAutoScalerProfile( + new ManagedClusterPropertiesAutoScalerProfile() + .withScanInterval("20s") + .withScaleDownDelayAfterAdd("15m")) + .withDiskEncryptionSetId( + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersCreate_OSSKU.json + */ + /** + * Sample code: Create Managed Cluster with OSSKU. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createManagedClusterWithOSSKU(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .createOrUpdate( + "rg1", + "clustername1", + new ManagedClusterInner() + .withLocation("location1") + .withTags(mapOf("archv2", "", "tier", "production")) + .withSku( + new ManagedClusterSku() + .withName(ManagedClusterSkuName.BASIC) + .withTier(ManagedClusterSkuTier.FREE)) + .withKubernetesVersion("") + .withDnsPrefix("dnsprefix1") + .withAgentPoolProfiles( + Arrays + .asList( + new ManagedClusterAgentPoolProfile() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withOsSku(Ossku.CBLMARINER) + .withType(AgentPoolType.VIRTUAL_MACHINE_SCALE_SETS) + .withMode(AgentPoolMode.SYSTEM) + .withEnableNodePublicIp(true) + .withName("nodepool1"))) + .withLinuxProfile( + new ContainerServiceLinuxProfile() + .withAdminUsername("azureuser") + .withSsh( + new ContainerServiceSshConfiguration() + .withPublicKeys( + Arrays.asList(new ContainerServiceSshPublicKey().withKeyData("keydata"))))) + .withWindowsProfile( + new ManagedClusterWindowsProfile() + .withAdminUsername("azureuser") + .withAdminPassword("replacePassword1234$")) + .withServicePrincipalProfile( + new ManagedClusterServicePrincipalProfile().withClientId("clientid").withSecret("secret")) + .withAddonProfiles(mapOf()) + .withEnableRbac(true) + .withEnablePodSecurityPolicy(true) + .withNetworkProfile( + new ContainerServiceNetworkProfile() + .withOutboundType(OutboundType.LOAD_BALANCER) + .withLoadBalancerSku(LoadBalancerSku.STANDARD) + .withLoadBalancerProfile( + new ManagedClusterLoadBalancerProfile() + .withManagedOutboundIPs( + new ManagedClusterLoadBalancerProfileManagedOutboundIPs().withCount(2)))) + .withAutoScalerProfile( + new ManagedClusterPropertiesAutoScalerProfile() + .withScanInterval("20s") + .withScaleDownDelayAfterAdd("15m")) + .withDiskEncryptionSetId( + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des") + .withHttpProxyConfig( + new ManagedClusterHttpProxyConfig() + .withHttpProxy("http://myproxy.server.com:8080") + .withHttpsProxy("https://myproxy.server.com:8080") + .withNoProxy(Arrays.asList("localhost", "127.0.0.1")) + .withTrustedCa("Q29uZ3JhdHMhIFlvdSBoYXZlIGZvdW5kIGEgaGlkZGVuIG1lc3NhZ2U=")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersCreate_Update.json + */ + /** + * Sample code: Create/Update Managed Cluster. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createUpdateManagedCluster(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .createOrUpdate( + "rg1", + "clustername1", + new ManagedClusterInner() + .withLocation("location1") + .withTags(mapOf("archv2", "", "tier", "production")) + .withSku( + new ManagedClusterSku() + .withName(ManagedClusterSkuName.BASIC) + .withTier(ManagedClusterSkuTier.FREE)) + .withIdentity( + new ManagedClusterIdentity() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/subid1/resourceGroups/rgName1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1", + new ManagedServiceIdentityUserAssignedIdentitiesValue()))) + .withKubernetesVersion("") + .withDnsPrefix("dnsprefix1") + .withAgentPoolProfiles( + Arrays + .asList( + new ManagedClusterAgentPoolProfile() + .withCount(3) + .withVmSize("Standard_DS1_v2") + .withOsType(OSType.LINUX) + .withScaleDownMode(ScaleDownMode.DEALLOCATE) + .withType(AgentPoolType.VIRTUAL_MACHINE_SCALE_SETS) + .withMode(AgentPoolMode.SYSTEM) + .withAvailabilityZones(Arrays.asList("1", "2", "3")) + .withEnableNodePublicIp(true) + .withName("nodepool1"))) + .withLinuxProfile( + new ContainerServiceLinuxProfile() + .withAdminUsername("azureuser") + .withSsh( + new ContainerServiceSshConfiguration() + .withPublicKeys( + Arrays.asList(new ContainerServiceSshPublicKey().withKeyData("keydata"))))) + .withWindowsProfile( + new ManagedClusterWindowsProfile() + .withAdminUsername("azureuser") + .withAdminPassword("replacePassword1234$")) + .withServicePrincipalProfile( + new ManagedClusterServicePrincipalProfile().withClientId("clientid").withSecret("secret")) + .withAddonProfiles(mapOf()) + .withEnableRbac(true) + .withEnablePodSecurityPolicy(true) + .withNetworkProfile( + new ContainerServiceNetworkProfile() + .withOutboundType(OutboundType.LOAD_BALANCER) + .withLoadBalancerSku(LoadBalancerSku.STANDARD) + .withLoadBalancerProfile( + new ManagedClusterLoadBalancerProfile() + .withManagedOutboundIPs( + new ManagedClusterLoadBalancerProfileManagedOutboundIPs().withCount(2)))) + .withAutoScalerProfile( + new ManagedClusterPropertiesAutoScalerProfile() + .withBalanceSimilarNodeGroups("true") + .withExpander(Expander.PRIORITY) + .withMaxNodeProvisionTime("15m") + .withNewPodScaleUpDelay("1m") + .withScanInterval("20s") + .withScaleDownDelayAfterAdd("15m") + .withSkipNodesWithSystemPods("false")) + .withDiskEncryptionSetId( + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersCreate_PrivateClusterFQDNSubdomain.json + */ + /** + * Sample code: Create Managed Private Cluster with fqdn subdomain specified. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createManagedPrivateClusterWithFqdnSubdomainSpecified( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .createOrUpdate( + "rg1", + "clustername1", + new ManagedClusterInner() + .withLocation("location1") + .withTags(mapOf("archv2", "", "tier", "production")) + .withSku( + new ManagedClusterSku() + .withName(ManagedClusterSkuName.BASIC) + .withTier(ManagedClusterSkuTier.FREE)) + .withKubernetesVersion("") + .withFqdnSubdomain("domain1") + .withAgentPoolProfiles( + Arrays + .asList( + new ManagedClusterAgentPoolProfile() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withType(AgentPoolType.VIRTUAL_MACHINE_SCALE_SETS) + .withMode(AgentPoolMode.SYSTEM) + .withEnableNodePublicIp(true) + .withEnableEncryptionAtHost(true) + .withName("nodepool1"))) + .withLinuxProfile( + new ContainerServiceLinuxProfile() + .withAdminUsername("azureuser") + .withSsh( + new ContainerServiceSshConfiguration() + .withPublicKeys( + Arrays.asList(new ContainerServiceSshPublicKey().withKeyData("keydata"))))) + .withWindowsProfile( + new ManagedClusterWindowsProfile() + .withAdminUsername("azureuser") + .withAdminPassword("replacePassword1234$")) + .withServicePrincipalProfile( + new ManagedClusterServicePrincipalProfile().withClientId("clientid").withSecret("secret")) + .withAddonProfiles(mapOf()) + .withEnableRbac(true) + .withEnablePodSecurityPolicy(true) + .withNetworkProfile( + new ContainerServiceNetworkProfile() + .withOutboundType(OutboundType.LOAD_BALANCER) + .withLoadBalancerSku(LoadBalancerSku.STANDARD) + .withLoadBalancerProfile( + new ManagedClusterLoadBalancerProfile() + .withManagedOutboundIPs( + new ManagedClusterLoadBalancerProfileManagedOutboundIPs().withCount(2)))) + .withAutoScalerProfile( + new ManagedClusterPropertiesAutoScalerProfile() + .withScanInterval("20s") + .withScaleDownDelayAfterAdd("15m")) + .withApiServerAccessProfile( + new ManagedClusterApiServerAccessProfile() + .withEnablePrivateCluster(true) + .withPrivateDnsZone( + "/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.Network/privateDnsZones/privatelink.location1.azmk8s.io")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersCreate_ManagedNATGateway.json + */ + /** + * Sample code: Create Managed Cluster with AKS-managed NAT gateway as outbound type. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createManagedClusterWithAKSManagedNATGatewayAsOutboundType( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .createOrUpdate( + "rg1", + "clustername1", + new ManagedClusterInner() + .withLocation("location1") + .withTags(mapOf("archv2", "", "tier", "production")) + .withSku( + new ManagedClusterSku() + .withName(ManagedClusterSkuName.BASIC) + .withTier(ManagedClusterSkuTier.FREE)) + .withKubernetesVersion("") + .withDnsPrefix("dnsprefix1") + .withAgentPoolProfiles( + Arrays + .asList( + new ManagedClusterAgentPoolProfile() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withType(AgentPoolType.VIRTUAL_MACHINE_SCALE_SETS) + .withMode(AgentPoolMode.SYSTEM) + .withEnableNodePublicIp(false) + .withName("nodepool1"))) + .withLinuxProfile( + new ContainerServiceLinuxProfile() + .withAdminUsername("azureuser") + .withSsh( + new ContainerServiceSshConfiguration() + .withPublicKeys( + Arrays.asList(new ContainerServiceSshPublicKey().withKeyData("keydata"))))) + .withWindowsProfile( + new ManagedClusterWindowsProfile() + .withAdminUsername("azureuser") + .withAdminPassword("replacePassword1234$")) + .withServicePrincipalProfile( + new ManagedClusterServicePrincipalProfile().withClientId("clientid").withSecret("secret")) + .withAddonProfiles(mapOf()) + .withEnableRbac(true) + .withEnablePodSecurityPolicy(true) + .withNetworkProfile( + new ContainerServiceNetworkProfile() + .withOutboundType(OutboundType.MANAGED_NATGATEWAY) + .withLoadBalancerSku(LoadBalancerSku.STANDARD) + .withNatGatewayProfile( + new ManagedClusterNatGatewayProfile() + .withManagedOutboundIpProfile( + new ManagedClusterManagedOutboundIpProfile().withCount(2)))) + .withAutoScalerProfile( + new ManagedClusterPropertiesAutoScalerProfile() + .withScanInterval("20s") + .withScaleDownDelayAfterAdd("15m")) + .withDiskEncryptionSetId( + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersCreate_UpdateWithEnableAzureRBAC.json + */ + /** + * Sample code: Create/Update AAD Managed Cluster with EnableAzureRBAC. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createUpdateAADManagedClusterWithEnableAzureRBAC( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .createOrUpdate( + "rg1", + "clustername1", + new ManagedClusterInner() + .withLocation("location1") + .withTags(mapOf("archv2", "", "tier", "production")) + .withSku( + new ManagedClusterSku() + .withName(ManagedClusterSkuName.BASIC) + .withTier(ManagedClusterSkuTier.FREE)) + .withKubernetesVersion("") + .withDnsPrefix("dnsprefix1") + .withAgentPoolProfiles( + Arrays + .asList( + new ManagedClusterAgentPoolProfile() + .withCount(3) + .withVmSize("Standard_DS1_v2") + .withOsType(OSType.LINUX) + .withType(AgentPoolType.VIRTUAL_MACHINE_SCALE_SETS) + .withMode(AgentPoolMode.SYSTEM) + .withAvailabilityZones(Arrays.asList("1", "2", "3")) + .withEnableNodePublicIp(true) + .withName("nodepool1"))) + .withLinuxProfile( + new ContainerServiceLinuxProfile() + .withAdminUsername("azureuser") + .withSsh( + new ContainerServiceSshConfiguration() + .withPublicKeys( + Arrays.asList(new ContainerServiceSshPublicKey().withKeyData("keydata"))))) + .withWindowsProfile( + new ManagedClusterWindowsProfile() + .withAdminUsername("azureuser") + .withAdminPassword("replacePassword1234$")) + .withServicePrincipalProfile( + new ManagedClusterServicePrincipalProfile().withClientId("clientid").withSecret("secret")) + .withAddonProfiles(mapOf()) + .withEnableRbac(true) + .withEnablePodSecurityPolicy(true) + .withNetworkProfile( + new ContainerServiceNetworkProfile() + .withOutboundType(OutboundType.LOAD_BALANCER) + .withLoadBalancerSku(LoadBalancerSku.STANDARD) + .withLoadBalancerProfile( + new ManagedClusterLoadBalancerProfile() + .withManagedOutboundIPs( + new ManagedClusterLoadBalancerProfileManagedOutboundIPs().withCount(2)))) + .withAadProfile(new ManagedClusterAadProfile().withManaged(true).withEnableAzureRbac(true)) + .withAutoScalerProfile( + new ManagedClusterPropertiesAutoScalerProfile() + .withScanInterval("20s") + .withScaleDownDelayAfterAdd("15m")) + .withDiskEncryptionSetId( + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersCreate_EnableUltraSSD.json + */ + /** + * Sample code: Create Managed Cluster with UltraSSD enabled. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createManagedClusterWithUltraSSDEnabled(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .createOrUpdate( + "rg1", + "clustername1", + new ManagedClusterInner() + .withLocation("location1") + .withTags(mapOf("archv2", "", "tier", "production")) + .withSku( + new ManagedClusterSku() + .withName(ManagedClusterSkuName.BASIC) + .withTier(ManagedClusterSkuTier.FREE)) + .withKubernetesVersion("") + .withDnsPrefix("dnsprefix1") + .withAgentPoolProfiles( + Arrays + .asList( + new ManagedClusterAgentPoolProfile() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withType(AgentPoolType.VIRTUAL_MACHINE_SCALE_SETS) + .withMode(AgentPoolMode.SYSTEM) + .withEnableNodePublicIp(true) + .withEnableUltraSsd(true) + .withName("nodepool1"))) + .withLinuxProfile( + new ContainerServiceLinuxProfile() + .withAdminUsername("azureuser") + .withSsh( + new ContainerServiceSshConfiguration() + .withPublicKeys( + Arrays.asList(new ContainerServiceSshPublicKey().withKeyData("keydata"))))) + .withWindowsProfile( + new ManagedClusterWindowsProfile() + .withAdminUsername("azureuser") + .withAdminPassword("replacePassword1234$")) + .withServicePrincipalProfile( + new ManagedClusterServicePrincipalProfile().withClientId("clientid").withSecret("secret")) + .withAddonProfiles(mapOf()) + .withEnableRbac(true) + .withEnablePodSecurityPolicy(true) + .withNetworkProfile( + new ContainerServiceNetworkProfile() + .withOutboundType(OutboundType.LOAD_BALANCER) + .withLoadBalancerSku(LoadBalancerSku.STANDARD) + .withLoadBalancerProfile( + new ManagedClusterLoadBalancerProfile() + .withManagedOutboundIPs( + new ManagedClusterLoadBalancerProfileManagedOutboundIPs().withCount(2)))) + .withAutoScalerProfile( + new ManagedClusterPropertiesAutoScalerProfile() + .withScanInterval("20s") + .withScaleDownDelayAfterAdd("15m")) + .withDiskEncryptionSetId( + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersCreate_UpdateWindowsGmsa.json + */ + /** + * Sample code: Create/Update Managed Cluster with Windows gMSA enabled. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createUpdateManagedClusterWithWindowsGMSAEnabled( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .createOrUpdate( + "rg1", + "clustername1", + new ManagedClusterInner() + .withLocation("location1") + .withTags(mapOf("archv2", "", "tier", "production")) + .withSku( + new ManagedClusterSku() + .withName(ManagedClusterSkuName.BASIC) + .withTier(ManagedClusterSkuTier.FREE)) + .withIdentity( + new ManagedClusterIdentity() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/subid1/resourceGroups/rgName1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1", + new ManagedServiceIdentityUserAssignedIdentitiesValue()))) + .withKubernetesVersion("") + .withDnsPrefix("dnsprefix1") + .withAgentPoolProfiles( + Arrays + .asList( + new ManagedClusterAgentPoolProfile() + .withCount(3) + .withVmSize("Standard_DS1_v2") + .withOsType(OSType.LINUX) + .withType(AgentPoolType.VIRTUAL_MACHINE_SCALE_SETS) + .withMode(AgentPoolMode.SYSTEM) + .withAvailabilityZones(Arrays.asList("1", "2", "3")) + .withEnableNodePublicIp(true) + .withName("nodepool1"))) + .withLinuxProfile( + new ContainerServiceLinuxProfile() + .withAdminUsername("azureuser") + .withSsh( + new ContainerServiceSshConfiguration() + .withPublicKeys( + Arrays.asList(new ContainerServiceSshPublicKey().withKeyData("keydata"))))) + .withWindowsProfile( + new ManagedClusterWindowsProfile() + .withAdminUsername("azureuser") + .withAdminPassword("replacePassword1234$") + .withGmsaProfile(new WindowsGmsaProfile().withEnabled(true))) + .withServicePrincipalProfile( + new ManagedClusterServicePrincipalProfile().withClientId("clientid").withSecret("secret")) + .withAddonProfiles(mapOf()) + .withEnableRbac(true) + .withEnablePodSecurityPolicy(true) + .withNetworkProfile( + new ContainerServiceNetworkProfile() + .withOutboundType(OutboundType.LOAD_BALANCER) + .withLoadBalancerSku(LoadBalancerSku.STANDARD) + .withLoadBalancerProfile( + new ManagedClusterLoadBalancerProfile() + .withManagedOutboundIPs( + new ManagedClusterLoadBalancerProfileManagedOutboundIPs().withCount(2)))) + .withAutoScalerProfile( + new ManagedClusterPropertiesAutoScalerProfile() + .withScanInterval("20s") + .withScaleDownDelayAfterAdd("15m")) + .withDiskEncryptionSetId( + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersCreate_GPUMIG.json + */ + /** + * Sample code: Create Managed Cluster with GPUMIG. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createManagedClusterWithGPUMIG(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .createOrUpdate( + "rg1", + "clustername1", + new ManagedClusterInner() + .withLocation("location1") + .withTags(mapOf("archv2", "", "tier", "production")) + .withSku( + new ManagedClusterSku() + .withName(ManagedClusterSkuName.BASIC) + .withTier(ManagedClusterSkuTier.FREE)) + .withKubernetesVersion("") + .withDnsPrefix("dnsprefix1") + .withAgentPoolProfiles( + Arrays + .asList( + new ManagedClusterAgentPoolProfile() + .withCount(3) + .withVmSize("Standard_ND96asr_v4") + .withOsType(OSType.LINUX) + .withType(AgentPoolType.VIRTUAL_MACHINE_SCALE_SETS) + .withMode(AgentPoolMode.SYSTEM) + .withEnableNodePublicIp(true) + .withGpuInstanceProfile(GpuInstanceProfile.MIG3G) + .withName("nodepool1"))) + .withLinuxProfile( + new ContainerServiceLinuxProfile() + .withAdminUsername("azureuser") + .withSsh( + new ContainerServiceSshConfiguration() + .withPublicKeys( + Arrays.asList(new ContainerServiceSshPublicKey().withKeyData("keydata"))))) + .withWindowsProfile( + new ManagedClusterWindowsProfile() + .withAdminUsername("azureuser") + .withAdminPassword("replacePassword1234$")) + .withServicePrincipalProfile( + new ManagedClusterServicePrincipalProfile().withClientId("clientid").withSecret("secret")) + .withAddonProfiles(mapOf()) + .withEnableRbac(true) + .withEnablePodSecurityPolicy(true) + .withNetworkProfile( + new ContainerServiceNetworkProfile() + .withOutboundType(OutboundType.LOAD_BALANCER) + .withLoadBalancerSku(LoadBalancerSku.STANDARD) + .withLoadBalancerProfile( + new ManagedClusterLoadBalancerProfile() + .withManagedOutboundIPs( + new ManagedClusterLoadBalancerProfileManagedOutboundIPs().withCount(2)))) + .withAutoScalerProfile( + new ManagedClusterPropertiesAutoScalerProfile() + .withScanInterval("20s") + .withScaleDownDelayAfterAdd("15m")) + .withDiskEncryptionSetId( + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des") + .withHttpProxyConfig( + new ManagedClusterHttpProxyConfig() + .withHttpProxy("http://myproxy.server.com:8080") + .withHttpsProxy("https://myproxy.server.com:8080") + .withNoProxy(Arrays.asList("localhost", "127.0.0.1")) + .withTrustedCa("Q29uZ3JhdHMhIFlvdSBoYXZlIGZvdW5kIGEgaGlkZGVuIG1lc3NhZ2U=")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersCreate_NodePublicIPPrefix.json + */ + /** + * Sample code: Create Managed Cluster with Node Public IP Prefix. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createManagedClusterWithNodePublicIPPrefix( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .createOrUpdate( + "rg1", + "clustername1", + new ManagedClusterInner() + .withLocation("location1") + .withTags(mapOf("archv2", "", "tier", "production")) + .withSku( + new ManagedClusterSku() + .withName(ManagedClusterSkuName.BASIC) + .withTier(ManagedClusterSkuTier.FREE)) + .withKubernetesVersion("") + .withDnsPrefix("dnsprefix1") + .withAgentPoolProfiles( + Arrays + .asList( + new ManagedClusterAgentPoolProfile() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withType(AgentPoolType.VIRTUAL_MACHINE_SCALE_SETS) + .withMode(AgentPoolMode.SYSTEM) + .withEnableNodePublicIp(true) + .withNodePublicIpPrefixId( + "/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.Network/publicIPPrefixes/public-ip-prefix") + .withName("nodepool1"))) + .withLinuxProfile( + new ContainerServiceLinuxProfile() + .withAdminUsername("azureuser") + .withSsh( + new ContainerServiceSshConfiguration() + .withPublicKeys( + Arrays.asList(new ContainerServiceSshPublicKey().withKeyData("keydata"))))) + .withWindowsProfile( + new ManagedClusterWindowsProfile() + .withAdminUsername("azureuser") + .withAdminPassword("replacePassword1234$")) + .withServicePrincipalProfile( + new ManagedClusterServicePrincipalProfile().withClientId("clientid").withSecret("secret")) + .withAddonProfiles(mapOf()) + .withEnableRbac(true) + .withEnablePodSecurityPolicy(true) + .withNetworkProfile( + new ContainerServiceNetworkProfile() + .withOutboundType(OutboundType.LOAD_BALANCER) + .withLoadBalancerSku(LoadBalancerSku.STANDARD) + .withLoadBalancerProfile( + new ManagedClusterLoadBalancerProfile() + .withManagedOutboundIPs( + new ManagedClusterLoadBalancerProfileManagedOutboundIPs().withCount(2)))) + .withAutoScalerProfile( + new ManagedClusterPropertiesAutoScalerProfile() + .withScanInterval("20s") + .withScaleDownDelayAfterAdd("15m")) + .withDiskEncryptionSetId( + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersCreate_EnableEncryptionAtHost.json + */ + /** + * Sample code: Create Managed Cluster with EncryptionAtHost enabled. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createManagedClusterWithEncryptionAtHostEnabled( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .createOrUpdate( + "rg1", + "clustername1", + new ManagedClusterInner() + .withLocation("location1") + .withTags(mapOf("archv2", "", "tier", "production")) + .withSku( + new ManagedClusterSku() + .withName(ManagedClusterSkuName.BASIC) + .withTier(ManagedClusterSkuTier.FREE)) + .withKubernetesVersion("") + .withDnsPrefix("dnsprefix1") + .withAgentPoolProfiles( + Arrays + .asList( + new ManagedClusterAgentPoolProfile() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withType(AgentPoolType.VIRTUAL_MACHINE_SCALE_SETS) + .withMode(AgentPoolMode.SYSTEM) + .withEnableNodePublicIp(true) + .withEnableEncryptionAtHost(true) + .withName("nodepool1"))) + .withLinuxProfile( + new ContainerServiceLinuxProfile() + .withAdminUsername("azureuser") + .withSsh( + new ContainerServiceSshConfiguration() + .withPublicKeys( + Arrays.asList(new ContainerServiceSshPublicKey().withKeyData("keydata"))))) + .withWindowsProfile( + new ManagedClusterWindowsProfile() + .withAdminUsername("azureuser") + .withAdminPassword("replacePassword1234$")) + .withServicePrincipalProfile( + new ManagedClusterServicePrincipalProfile().withClientId("clientid").withSecret("secret")) + .withAddonProfiles(mapOf()) + .withEnableRbac(true) + .withEnablePodSecurityPolicy(true) + .withNetworkProfile( + new ContainerServiceNetworkProfile() + .withOutboundType(OutboundType.LOAD_BALANCER) + .withLoadBalancerSku(LoadBalancerSku.STANDARD) + .withLoadBalancerProfile( + new ManagedClusterLoadBalancerProfile() + .withManagedOutboundIPs( + new ManagedClusterLoadBalancerProfileManagedOutboundIPs().withCount(2)))) + .withAutoScalerProfile( + new ManagedClusterPropertiesAutoScalerProfile() + .withScanInterval("20s") + .withScaleDownDelayAfterAdd("15m")) + .withDiskEncryptionSetId( + "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Compute/diskEncryptionSets/des"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersCreate_PrivateClusterPublicFQDN.json + */ + /** + * Sample code: Create Managed Private Cluster with Public FQDN specified. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createManagedPrivateClusterWithPublicFQDNSpecified( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .createOrUpdate( + "rg1", + "clustername1", + new ManagedClusterInner() + .withLocation("location1") + .withTags(mapOf("archv2", "", "tier", "production")) + .withSku( + new ManagedClusterSku() + .withName(ManagedClusterSkuName.BASIC) + .withTier(ManagedClusterSkuTier.FREE)) + .withKubernetesVersion("") + .withDnsPrefix("dnsprefix1") + .withAgentPoolProfiles( + Arrays + .asList( + new ManagedClusterAgentPoolProfile() + .withCount(3) + .withVmSize("Standard_DS2_v2") + .withOsType(OSType.LINUX) + .withType(AgentPoolType.VIRTUAL_MACHINE_SCALE_SETS) + .withMode(AgentPoolMode.SYSTEM) + .withEnableNodePublicIp(true) + .withEnableEncryptionAtHost(true) + .withName("nodepool1"))) + .withLinuxProfile( + new ContainerServiceLinuxProfile() + .withAdminUsername("azureuser") + .withSsh( + new ContainerServiceSshConfiguration() + .withPublicKeys( + Arrays.asList(new ContainerServiceSshPublicKey().withKeyData("keydata"))))) + .withWindowsProfile( + new ManagedClusterWindowsProfile() + .withAdminUsername("azureuser") + .withAdminPassword("replacePassword1234$")) + .withServicePrincipalProfile( + new ManagedClusterServicePrincipalProfile().withClientId("clientid").withSecret("secret")) + .withAddonProfiles(mapOf()) + .withEnableRbac(true) + .withEnablePodSecurityPolicy(true) + .withNetworkProfile( + new ContainerServiceNetworkProfile() + .withOutboundType(OutboundType.LOAD_BALANCER) + .withLoadBalancerSku(LoadBalancerSku.STANDARD) + .withLoadBalancerProfile( + new ManagedClusterLoadBalancerProfile() + .withManagedOutboundIPs( + new ManagedClusterLoadBalancerProfileManagedOutboundIPs().withCount(2)))) + .withAutoScalerProfile( + new ManagedClusterPropertiesAutoScalerProfile() + .withScanInterval("20s") + .withScaleDownDelayAfterAdd("15m")) + .withApiServerAccessProfile( + new ManagedClusterApiServerAccessProfile() + .withEnablePrivateCluster(true) + .withEnablePrivateClusterPublicFqdn(true)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersDeleteSamples.java new file mode 100644 index 0000000000000..c0fa7119f2867 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedClusters Delete. */ +public final class ManagedClustersDeleteSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersDelete.json + */ + /** + * Sample code: Delete Managed Cluster. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteManagedCluster(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .delete("rg1", "clustername1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersGetAccessProfileSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersGetAccessProfileSamples.java new file mode 100644 index 0000000000000..7da367045a6c9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersGetAccessProfileSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedClusters GetAccessProfile. */ +public final class ManagedClustersGetAccessProfileSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersGetAccessProfile.json + */ + /** + * Sample code: Get Managed Cluster. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getManagedCluster(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .getAccessProfileWithResponse("rg1", "clustername1", "clusterUser", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..9240da2b5b28c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedClusters GetByResourceGroup. */ +public final class ManagedClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersGet.json + */ + /** + * Sample code: Get Managed Cluster. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getManagedCluster(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .getByResourceGroupWithResponse("rg1", "clustername1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersGetCommandResultSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersGetCommandResultSamples.java new file mode 100644 index 0000000000000..95b58d6169431 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersGetCommandResultSamples.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.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedClusters GetCommandResult. */ +public final class ManagedClustersGetCommandResultSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/RunCommandResultFailed.json + */ + /** + * Sample code: commandFailedResult. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void commandFailedResult(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .getCommandResultWithResponse("rg1", "clustername1", "def7b3ea71bd4f7e9d226ddbc0f00ad9", Context.NONE); + } + + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/RunCommandResultSucceed.json + */ + /** + * Sample code: commandSucceedResult. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void commandSucceedResult(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .getCommandResultWithResponse("rg1", "clustername1", "def7b3ea71bd4f7e9d226ddbc0f00ad9", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersGetOSOptionsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersGetOSOptionsSamples.java new file mode 100644 index 0000000000000..879af8e1ccdf8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersGetOSOptionsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedClusters GetOSOptions. */ +public final class ManagedClustersGetOSOptionsSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ContainerServiceGetOSOptions.json + */ + /** + * Sample code: Get Container Service OS Options. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getContainerServiceOSOptions(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .getOSOptionsWithResponse("location1", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersGetUpgradeProfileSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersGetUpgradeProfileSamples.java new file mode 100644 index 0000000000000..e8222b76b5212 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersGetUpgradeProfileSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedClusters GetUpgradeProfile. */ +public final class ManagedClustersGetUpgradeProfileSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersGetUpgradeProfile.json + */ + /** + * Sample code: Get Upgrade Profile for Managed Cluster. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getUpgradeProfileForManagedCluster(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .getUpgradeProfileWithResponse("rg1", "clustername1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersListByResourceGroupSamples.java new file mode 100644 index 0000000000000..b116387c89e6b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersListByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedClusters ListByResourceGroup. */ +public final class ManagedClustersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersListByResourceGroup.json + */ + /** + * Sample code: Get Managed Clusters by Resource Group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getManagedClustersByResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersListClusterAdminCredentialsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersListClusterAdminCredentialsSamples.java new file mode 100644 index 0000000000000..72408ad69525a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersListClusterAdminCredentialsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedClusters ListClusterAdminCredentials. */ +public final class ManagedClustersListClusterAdminCredentialsSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersListClusterCredentialResult.json + */ + /** + * Sample code: Get Managed Cluster. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getManagedCluster(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .listClusterAdminCredentialsWithResponse("rg1", "clustername1", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersListClusterMonitoringUserCredentialsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersListClusterMonitoringUserCredentialsSamples.java new file mode 100644 index 0000000000000..22a60c71ce264 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersListClusterMonitoringUserCredentialsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedClusters ListClusterMonitoringUserCredentials. */ +public final class ManagedClustersListClusterMonitoringUserCredentialsSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersListClusterCredentialResult.json + */ + /** + * Sample code: Get Managed Cluster. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getManagedCluster(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .listClusterMonitoringUserCredentialsWithResponse("rg1", "clustername1", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersListClusterUserCredentialsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersListClusterUserCredentialsSamples.java new file mode 100644 index 0000000000000..c5f9f7fb0d143 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersListClusterUserCredentialsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedClusters ListClusterUserCredentials. */ +public final class ManagedClustersListClusterUserCredentialsSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersListClusterCredentialResult.json + */ + /** + * Sample code: Get Managed Cluster. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getManagedCluster(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .listClusterUserCredentialsWithResponse("rg1", "clustername1", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersListOutboundNetworkDependenciesEndpointsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersListOutboundNetworkDependenciesEndpointsSamples.java new file mode 100644 index 0000000000000..4d68f4e88f016 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersListOutboundNetworkDependenciesEndpointsSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedClusters ListOutboundNetworkDependenciesEndpoints. */ +public final class ManagedClustersListOutboundNetworkDependenciesEndpointsSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/OutboundNetworkDependenciesEndpointsList.json + */ + /** + * Sample code: List OutboundNetworkDependenciesEndpoints by Managed Cluster. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listOutboundNetworkDependenciesEndpointsByManagedCluster( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .listOutboundNetworkDependenciesEndpoints("rg1", "clustername1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersListSamples.java new file mode 100644 index 0000000000000..5c6ee4f586334 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersListSamples.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.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedClusters List. */ +public final class ManagedClustersListSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersList.json + */ + /** + * Sample code: List Managed Clusters. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listManagedClusters(com.azure.resourcemanager.AzureResourceManager azure) { + azure.kubernetesClusters().manager().serviceClient().getManagedClusters().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersResetAadProfileSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersResetAadProfileSamples.java new file mode 100644 index 0000000000000..97f8f522ef99c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersResetAadProfileSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerservice.models.ManagedClusterAadProfile; + +/** Samples for ManagedClusters ResetAadProfile. */ +public final class ManagedClustersResetAadProfileSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersResetAADProfile.json + */ + /** + * Sample code: Reset AAD Profile. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void resetAADProfile(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .resetAadProfile( + "rg1", + "clustername1", + new ManagedClusterAadProfile() + .withClientAppId("clientappid") + .withServerAppId("serverappid") + .withServerAppSecret("serverappsecret") + .withTenantId("tenantid"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersResetServicePrincipalProfileSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersResetServicePrincipalProfileSamples.java new file mode 100644 index 0000000000000..c43417879fe84 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersResetServicePrincipalProfileSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerservice.models.ManagedClusterServicePrincipalProfile; + +/** Samples for ManagedClusters ResetServicePrincipalProfile. */ +public final class ManagedClustersResetServicePrincipalProfileSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersResetServicePrincipalProfile.json + */ + /** + * Sample code: Reset Service Principal Profile. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void resetServicePrincipalProfile(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .resetServicePrincipalProfile( + "rg1", + "clustername1", + new ManagedClusterServicePrincipalProfile().withClientId("clientid").withSecret("secret"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersRotateClusterCertificatesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersRotateClusterCertificatesSamples.java new file mode 100644 index 0000000000000..380bf9ae70c8c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersRotateClusterCertificatesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedClusters RotateClusterCertificates. */ +public final class ManagedClustersRotateClusterCertificatesSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersRotateClusterCertificates.json + */ + /** + * Sample code: Rotate Cluster Certificates. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void rotateClusterCertificates(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .rotateClusterCertificates("rg1", "clustername1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersRunCommandSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersRunCommandSamples.java new file mode 100644 index 0000000000000..9d12bcf0afff5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersRunCommandSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerservice.models.RunCommandRequest; + +/** Samples for ManagedClusters RunCommand. */ +public final class ManagedClustersRunCommandSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/RunCommandRequest.json + */ + /** + * Sample code: submitNewCommand. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void submitNewCommand(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .runCommand( + "rg1", + "clustername1", + new RunCommandRequest().withCommand("kubectl apply -f ns.yaml").withContext("").withClusterToken(""), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersStartSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersStartSamples.java new file mode 100644 index 0000000000000..7132bdfeca646 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersStartSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedClusters Start. */ +public final class ManagedClustersStartSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersStart.json + */ + /** + * Sample code: Start Managed Cluster. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void startManagedCluster(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .start("rg1", "clustername1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersStopSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersStopSamples.java new file mode 100644 index 0000000000000..779ca1b3ba0c6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersStopSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedClusters Stop. */ +public final class ManagedClustersStopSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersStop.json + */ + /** + * Sample code: Stop Managed Cluster. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void stopManagedCluster(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .stop("rg1", "clustername1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersUpdateTagsSamples.java new file mode 100644 index 0000000000000..8688a76ffe9f8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ManagedClustersUpdateTagsSamples.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.containerservice.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerservice.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ManagedClusters UpdateTags. */ +public final class ManagedClustersUpdateTagsSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ManagedClustersUpdateTags.json + */ + /** + * Sample code: Update Managed Cluster Tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateManagedClusterTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getManagedClusters() + .updateTags( + "rg1", "clustername1", new TagsObject().withTags(mapOf("archv3", "", "tier", "testing")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/OpenShiftManagedClustersCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/OpenShiftManagedClustersCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..5485c60665da4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/OpenShiftManagedClustersCreateOrUpdateSamples.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.containerservice.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerservice.fluent.models.OpenShiftManagedClusterInner; +import com.azure.resourcemanager.containerservice.models.NetworkProfile; +import com.azure.resourcemanager.containerservice.models.OSType; +import com.azure.resourcemanager.containerservice.models.OpenShiftAgentPoolProfileRole; +import com.azure.resourcemanager.containerservice.models.OpenShiftContainerServiceVMSize; +import com.azure.resourcemanager.containerservice.models.OpenShiftManagedClusterAadIdentityProvider; +import com.azure.resourcemanager.containerservice.models.OpenShiftManagedClusterAgentPoolProfile; +import com.azure.resourcemanager.containerservice.models.OpenShiftManagedClusterAuthProfile; +import com.azure.resourcemanager.containerservice.models.OpenShiftManagedClusterIdentityProvider; +import com.azure.resourcemanager.containerservice.models.OpenShiftManagedClusterMasterPoolProfile; +import com.azure.resourcemanager.containerservice.models.OpenShiftRouterProfile; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for OpenShiftManagedClusters CreateOrUpdate. */ +public final class OpenShiftManagedClustersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2019-04-30/examples/OpenShiftManagedClustersCreate_Update.json + */ + /** + * Sample code: Create/Update OpenShift Managed Cluster. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createUpdateOpenShiftManagedCluster(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getOpenShiftManagedClusters() + .createOrUpdate( + "rg1", + "clustername1", + new OpenShiftManagedClusterInner() + .withLocation("location1") + .withTags(mapOf("archv2", "", "tier", "production")) + .withOpenShiftVersion("v3.11") + .withNetworkProfile(new NetworkProfile().withVnetCidr("10.0.0.0/8")) + .withRouterProfiles(Arrays.asList(new OpenShiftRouterProfile().withName("default"))) + .withMasterPoolProfile( + new OpenShiftManagedClusterMasterPoolProfile() + .withName("master") + .withCount(3) + .withVmSize(OpenShiftContainerServiceVMSize.STANDARD_D4S_V3) + .withSubnetCidr("10.0.0.0/24") + .withOsType(OSType.LINUX)) + .withAgentPoolProfiles( + Arrays + .asList( + new OpenShiftManagedClusterAgentPoolProfile() + .withName("infra") + .withCount(2) + .withVmSize(OpenShiftContainerServiceVMSize.STANDARD_D4S_V3) + .withSubnetCidr("10.0.0.0/24") + .withOsType(OSType.LINUX) + .withRole(OpenShiftAgentPoolProfileRole.INFRA), + new OpenShiftManagedClusterAgentPoolProfile() + .withName("compute") + .withCount(4) + .withVmSize(OpenShiftContainerServiceVMSize.STANDARD_D4S_V3) + .withSubnetCidr("10.0.0.0/24") + .withOsType(OSType.LINUX) + .withRole(OpenShiftAgentPoolProfileRole.COMPUTE))) + .withAuthProfile( + new OpenShiftManagedClusterAuthProfile() + .withIdentityProviders( + Arrays + .asList( + new OpenShiftManagedClusterIdentityProvider() + .withName("Azure AD") + .withProvider( + new OpenShiftManagedClusterAadIdentityProvider() + .withClientId("clientId") + .withSecret("secret") + .withTenantId("tenantId") + .withCustomerAdminGroupId("customerAdminGroupId"))))), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/OpenShiftManagedClustersDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/OpenShiftManagedClustersDeleteSamples.java new file mode 100644 index 0000000000000..12c26b6086f12 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/OpenShiftManagedClustersDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for OpenShiftManagedClusters Delete. */ +public final class OpenShiftManagedClustersDeleteSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2019-04-30/examples/OpenShiftManagedClustersDelete.json + */ + /** + * Sample code: Delete OpenShift Managed Cluster. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteOpenShiftManagedCluster(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getOpenShiftManagedClusters() + .delete("rg1", "clustername1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/OpenShiftManagedClustersGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/OpenShiftManagedClustersGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..c179244508b49 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/OpenShiftManagedClustersGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for OpenShiftManagedClusters GetByResourceGroup. */ +public final class OpenShiftManagedClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2019-04-30/examples/OpenShiftManagedClustersGet.json + */ + /** + * Sample code: Get OpenShift Managed Cluster. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getOpenShiftManagedCluster(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getOpenShiftManagedClusters() + .getByResourceGroupWithResponse("rg1", "clustername1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/OpenShiftManagedClustersListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/OpenShiftManagedClustersListByResourceGroupSamples.java new file mode 100644 index 0000000000000..d94b7190c3028 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/OpenShiftManagedClustersListByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for OpenShiftManagedClusters ListByResourceGroup. */ +public final class OpenShiftManagedClustersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2019-04-30/examples/OpenShiftManagedClustersListByResourceGroup.json + */ + /** + * Sample code: Get Managed Clusters by Resource Group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getManagedClustersByResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getOpenShiftManagedClusters() + .listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/OpenShiftManagedClustersListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/OpenShiftManagedClustersListSamples.java new file mode 100644 index 0000000000000..33cc5e7f7cc82 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/OpenShiftManagedClustersListSamples.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.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for OpenShiftManagedClusters List. */ +public final class OpenShiftManagedClustersListSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2019-04-30/examples/OpenShiftManagedClustersList.json + */ + /** + * Sample code: List Managed Clusters. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listManagedClusters(com.azure.resourcemanager.AzureResourceManager azure) { + azure.kubernetesClusters().manager().serviceClient().getOpenShiftManagedClusters().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/OpenShiftManagedClustersUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/OpenShiftManagedClustersUpdateTagsSamples.java new file mode 100644 index 0000000000000..fd13b7b1f307f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/OpenShiftManagedClustersUpdateTagsSamples.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.containerservice.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerservice.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for OpenShiftManagedClusters UpdateTags. */ +public final class OpenShiftManagedClustersUpdateTagsSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2019-04-30/examples/OpenShiftManagedClustersUpdateTags.json + */ + /** + * Sample code: Update OpenShift Managed Cluster Tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateOpenShiftManagedClusterTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getOpenShiftManagedClusters() + .updateTags( + "rg1", "clustername1", new TagsObject().withTags(mapOf("archv3", "", "tier", "testing")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/PrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..4b75cb5092274 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/PrivateEndpointConnectionsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/PrivateEndpointConnectionsDelete.json + */ + /** + * Sample code: Delete Private Endpoint Connection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deletePrivateEndpointConnection(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getPrivateEndpointConnections() + .delete("rg1", "clustername1", "privateendpointconnection1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/PrivateEndpointConnectionsGetSamples.java new file mode 100644 index 0000000000000..3c7a43aa967f2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/PrivateEndpointConnectionsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/PrivateEndpointConnectionsGet.json + */ + /** + * Sample code: Get Private Endpoint Connection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getPrivateEndpointConnection(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse("rg1", "clustername1", "privateendpointconnection1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/PrivateEndpointConnectionsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/PrivateEndpointConnectionsListSamples.java new file mode 100644 index 0000000000000..1425fa9a7bcde --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/PrivateEndpointConnectionsListSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections List. */ +public final class PrivateEndpointConnectionsListSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/PrivateEndpointConnectionsList.json + */ + /** + * Sample code: List Private Endpoint Connections by Managed Cluster. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listPrivateEndpointConnectionsByManagedCluster( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getPrivateEndpointConnections() + .listWithResponse("rg1", "clustername1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/PrivateEndpointConnectionsUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/PrivateEndpointConnectionsUpdateSamples.java new file mode 100644 index 0000000000000..c50eba6a9cd4c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/PrivateEndpointConnectionsUpdateSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerservice.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.containerservice.models.ConnectionStatus; +import com.azure.resourcemanager.containerservice.models.PrivateLinkServiceConnectionState; + +/** Samples for PrivateEndpointConnections Update. */ +public final class PrivateEndpointConnectionsUpdateSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/PrivateEndpointConnectionsUpdate.json + */ + /** + * Sample code: Update Private Endpoint Connection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updatePrivateEndpointConnection(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getPrivateEndpointConnections() + .updateWithResponse( + "rg1", + "clustername1", + "privateendpointconnection1", + new PrivateEndpointConnectionInner() + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState().withStatus(ConnectionStatus.APPROVED)), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/PrivateLinkResourcesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/PrivateLinkResourcesListSamples.java new file mode 100644 index 0000000000000..40cff23e46eab --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/PrivateLinkResourcesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources List. */ +public final class PrivateLinkResourcesListSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/PrivateLinkResourcesList.json + */ + /** + * Sample code: List Private Link Resources by Managed Cluster. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listPrivateLinkResourcesByManagedCluster(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getPrivateLinkResources() + .listWithResponse("rg1", "clustername1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ResolvePrivateLinkServiceIdPostSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ResolvePrivateLinkServiceIdPostSamples.java new file mode 100644 index 0000000000000..590a541be2564 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/ResolvePrivateLinkServiceIdPostSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerservice.fluent.models.PrivateLinkResourceInner; + +/** Samples for ResolvePrivateLinkServiceId Post. */ +public final class ResolvePrivateLinkServiceIdPostSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/ResolvePrivateLinkServiceId.json + */ + /** + * Sample code: Resolve the Private Link Service ID for Managed Cluster. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void resolveThePrivateLinkServiceIDForManagedCluster( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getResolvePrivateLinkServiceIds() + .postWithResponse( + "rg1", "clustername1", new PrivateLinkResourceInner().withName("management"), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/SnapshotsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/SnapshotsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..b6776b5dfe02c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/SnapshotsCreateOrUpdateSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerservice.fluent.models.SnapshotInner; +import com.azure.resourcemanager.containerservice.models.CreationData; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Snapshots CreateOrUpdate. */ +public final class SnapshotsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/SnapshotsCreate.json + */ + /** + * Sample code: Create/Update Snapshot. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createUpdateSnapshot(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getSnapshots() + .createOrUpdateWithResponse( + "rg1", + "snapshot1", + new SnapshotInner() + .withLocation("westus") + .withTags(mapOf("key1", "val1", "key2", "val2")) + .withCreationData( + new CreationData() + .withSourceResourceId( + "/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster1/agentPools/pool0")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/SnapshotsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/SnapshotsDeleteSamples.java new file mode 100644 index 0000000000000..7c90171ccaab3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/SnapshotsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for Snapshots Delete. */ +public final class SnapshotsDeleteSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/SnapshotsDelete.json + */ + /** + * Sample code: Delete Snapshot. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteSnapshot(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getSnapshots() + .deleteWithResponse("rg1", "snapshot1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/SnapshotsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/SnapshotsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..5bc230d021b14 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/SnapshotsGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for Snapshots GetByResourceGroup. */ +public final class SnapshotsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/SnapshotsGet.json + */ + /** + * Sample code: Get Snapshot. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getSnapshot(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getSnapshots() + .getByResourceGroupWithResponse("rg1", "snapshot1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/SnapshotsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/SnapshotsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..c61e9f9cdcc37 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/SnapshotsListByResourceGroupSamples.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.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for Snapshots ListByResourceGroup. */ +public final class SnapshotsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/SnapshotsListByResourceGroup.json + */ + /** + * Sample code: List Snapshots by Resource Group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listSnapshotsByResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.kubernetesClusters().manager().serviceClient().getSnapshots().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/SnapshotsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/SnapshotsListSamples.java new file mode 100644 index 0000000000000..f422286d73c19 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/SnapshotsListSamples.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.containerservice.generated; + +import com.azure.core.util.Context; + +/** Samples for Snapshots List. */ +public final class SnapshotsListSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/SnapshotsList.json + */ + /** + * Sample code: List Snapshots. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listSnapshots(com.azure.resourcemanager.AzureResourceManager azure) { + azure.kubernetesClusters().manager().serviceClient().getSnapshots().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/SnapshotsUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/SnapshotsUpdateTagsSamples.java new file mode 100644 index 0000000000000..79087e32da4cc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/SnapshotsUpdateTagsSamples.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.containerservice.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerservice.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Snapshots UpdateTags. */ +public final class SnapshotsUpdateTagsSamples { + /* + * x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/stable/2021-09-01/examples/SnapshotsUpdateTags.json + */ + /** + * Sample code: Update Snapshot Tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateSnapshotTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .kubernetesClusters() + .manager() + .serviceClient() + .getSnapshots() + .updateTagsWithResponse( + "rg1", "snapshot1", new TagsObject().withTags(mapOf("key2", "new-val2", "key3", "val3")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersCreateUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersCreateUpdateSamples.java new file mode 100644 index 0000000000000..202e0cc1dab6c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersCreateUpdateSamples.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.fluent.models.ClusterResourceInner; +import com.azure.resourcemanager.cosmos.models.AuthenticationMethod; +import com.azure.resourcemanager.cosmos.models.Certificate; +import com.azure.resourcemanager.cosmos.models.ClusterResourceProperties; +import com.azure.resourcemanager.cosmos.models.SeedNode; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraClusters CreateUpdate. */ +public final class CassandraClustersCreateUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBManagedCassandraClusterCreate.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBManagedCassandraClusterCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraClusters() + .createUpdate( + "cassandra-prod-rg", + "cassandra-prod", + new ClusterResourceInner() + .withLocation("West US") + .withTags(mapOf()) + .withProperties( + new ClusterResourceProperties() + .withDelegatedManagementSubnetId( + "/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/management") + .withCassandraVersion("3.11") + .withClusterNameOverride("ClusterNameIllegalForAzureResource") + .withAuthenticationMethod(AuthenticationMethod.CASSANDRA) + .withInitialCassandraAdminPassword("mypassword") + .withClientCertificates( + Arrays + .asList( + new Certificate() + .withPem( + "-----BEGIN CERTIFICATE-----\n" + + "...Base64 encoded certificate...\n" + + "-----END CERTIFICATE-----"))) + .withExternalGossipCertificates( + Arrays + .asList( + new Certificate() + .withPem( + "-----BEGIN CERTIFICATE-----\n" + + "...Base64 encoded certificate...\n" + + "-----END CERTIFICATE-----"))) + .withExternalSeedNodes( + Arrays + .asList( + new SeedNode().withIpAddress("10.52.221.2"), + new SeedNode().withIpAddress("10.52.221.3"), + new SeedNode().withIpAddress("10.52.221.4"))) + .withHoursBetweenBackups(24)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersDeallocateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersDeallocateSamples.java new file mode 100644 index 0000000000000..86e7bc7efa328 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersDeallocateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraClusters Deallocate. */ +public final class CassandraClustersDeallocateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBManagedCassandraClusterDeallocate.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterDeallocate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBManagedCassandraClusterDeallocate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraClusters() + .deallocate("cassandra-prod-rg", "cassandra-prod", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersDeleteSamples.java new file mode 100644 index 0000000000000..d64e6d82a3113 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraClusters Delete. */ +public final class CassandraClustersDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBManagedCassandraClusterDelete.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBManagedCassandraClusterDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraClusters() + .delete("cassandra-prod-rg", "cassandra-prod", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..9bbbf886aa913 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraClusters GetByResourceGroup. */ +public final class CassandraClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBManagedCassandraClusterGet.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBManagedCassandraClusterGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraClusters() + .getByResourceGroupWithResponse("cassandra-prod-rg", "cassandra-prod", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersInvokeCommandSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersInvokeCommandSamples.java new file mode 100644 index 0000000000000..8bf14e8853475 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersInvokeCommandSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.CommandPostBody; + +/** Samples for CassandraClusters InvokeCommand. */ +public final class CassandraClustersInvokeCommandSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBManagedCassandraCommand.json + */ + /** + * Sample code: CosmosDBManagedCassandraCommand. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBManagedCassandraCommand(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraClusters() + .invokeCommand( + "cassandra-prod-rg", + "cassandra-prod", + new CommandPostBody().withCommand("nodetool status").withHost("10.0.1.12"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersListByResourceGroupSamples.java new file mode 100644 index 0000000000000..e4a5a796b2136 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersListByResourceGroupSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraClusters ListByResourceGroup. */ +public final class CassandraClustersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBManagedCassandraClusterListByResourceGroup.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterListByResourceGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBManagedCassandraClusterListByResourceGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraClusters() + .listByResourceGroup("cassandra-prod-rg", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersListSamples.java new file mode 100644 index 0000000000000..8e6228d7e8764 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersListSamples.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.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraClusters List. */ +public final class CassandraClustersListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBManagedCassandraClusterListBySubscription.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterListBySubscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBManagedCassandraClusterListBySubscription( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.cosmosDBAccounts().manager().serviceClient().getCassandraClusters().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersStartSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersStartSamples.java new file mode 100644 index 0000000000000..0e6070126f868 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersStartSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraClusters Start. */ +public final class CassandraClustersStartSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBManagedCassandraClusterStart.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterStart. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBManagedCassandraClusterStart(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraClusters() + .start("cassandra-prod-rg", "cassandra-prod", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersStatusSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersStatusSamples.java new file mode 100644 index 0000000000000..98dcd8026d6dc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersStatusSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraClusters Status. */ +public final class CassandraClustersStatusSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBManagedCassandraStatus.json + */ + /** + * Sample code: CosmosDBManagedCassandraStatus. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBManagedCassandraStatus(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraClusters() + .statusWithResponse("cassandra-prod-rg", "cassandra-prod", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersUpdateSamples.java new file mode 100644 index 0000000000000..4ac563c4ed4a6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraClustersUpdateSamples.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.fluent.models.ClusterResourceInner; +import com.azure.resourcemanager.cosmos.models.AuthenticationMethod; +import com.azure.resourcemanager.cosmos.models.Certificate; +import com.azure.resourcemanager.cosmos.models.ClusterResourceProperties; +import com.azure.resourcemanager.cosmos.models.SeedNode; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraClusters Update. */ +public final class CassandraClustersUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBManagedCassandraClusterPatch.json + */ + /** + * Sample code: CosmosDBManagedCassandraClusterPatch. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBManagedCassandraClusterPatch(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraClusters() + .update( + "cassandra-prod-rg", + "cassandra-prod", + new ClusterResourceInner() + .withTags(mapOf("owner", "mike")) + .withProperties( + new ClusterResourceProperties() + .withAuthenticationMethod(AuthenticationMethod.NONE) + .withExternalGossipCertificates( + Arrays + .asList( + new Certificate() + .withPem( + "-----BEGIN CERTIFICATE-----\n" + + "...Base64 encoded certificate...\n" + + "-----END CERTIFICATE-----"))) + .withExternalSeedNodes( + Arrays + .asList( + new SeedNode().withIpAddress("10.52.221.2"), + new SeedNode().withIpAddress("10.52.221.3"), + new SeedNode().withIpAddress("10.52.221.4"))) + .withHoursBetweenBackups(12)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraDataCentersCreateUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraDataCentersCreateUpdateSamples.java new file mode 100644 index 0000000000000..0e91902a439d6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraDataCentersCreateUpdateSamples.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.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.fluent.models.DataCenterResourceInner; +import com.azure.resourcemanager.cosmos.models.DataCenterResourceProperties; + +/** Samples for CassandraDataCenters CreateUpdate. */ +public final class CassandraDataCentersCreateUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBManagedCassandraDataCenterCreate.json + */ + /** + * Sample code: CosmosDBManagedCassandraDataCenterCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBManagedCassandraDataCenterCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraDataCenters() + .createUpdate( + "cassandra-prod-rg", + "cassandra-prod", + "dc1", + new DataCenterResourceInner() + .withProperties( + new DataCenterResourceProperties() + .withDataCenterLocation("West US 2") + .withDelegatedSubnetId( + "/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/dc1-subnet") + .withNodeCount(9) + .withBase64EncodedCassandraYamlFragment( + "Y29tcGFjdGlvbl90aHJvdWdocHV0X21iX3Blcl9zZWM6IDMyCmNvbXBhY3Rpb25fbGFyZ2VfcGFydGl0aW9uX3dhcm5pbmdfdGhyZXNob2xkX21iOiAxMDA=")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraDataCentersDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraDataCentersDeleteSamples.java new file mode 100644 index 0000000000000..a3e1926cf865a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraDataCentersDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraDataCenters Delete. */ +public final class CassandraDataCentersDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBManagedCassandraDataCenterDelete.json + */ + /** + * Sample code: CosmosDBManagedCassandraDataCenterDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBManagedCassandraDataCenterDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraDataCenters() + .delete("cassandra-prod-rg", "cassandra-prod", "dc1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraDataCentersGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraDataCentersGetSamples.java new file mode 100644 index 0000000000000..b7d0e7d9f84a6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraDataCentersGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraDataCenters Get. */ +public final class CassandraDataCentersGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBManagedCassandraDataCenterGet.json + */ + /** + * Sample code: CosmosDBManagedCassandraDataCenterGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBManagedCassandraDataCenterGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraDataCenters() + .getWithResponse("cassandra-prod-rg", "cassandra-prod", "dc1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraDataCentersListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraDataCentersListSamples.java new file mode 100644 index 0000000000000..c5fef359e98ac --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraDataCentersListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraDataCenters List. */ +public final class CassandraDataCentersListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBManagedCassandraDataCenterList.json + */ + /** + * Sample code: CosmosDBManagedCassandraDataCenterList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBManagedCassandraDataCenterList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraDataCenters() + .list("cassandra-prod-rg", "cassandra-prod", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraDataCentersUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraDataCentersUpdateSamples.java new file mode 100644 index 0000000000000..f6c643bfa182c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraDataCentersUpdateSamples.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.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.fluent.models.DataCenterResourceInner; +import com.azure.resourcemanager.cosmos.models.DataCenterResourceProperties; + +/** Samples for CassandraDataCenters Update. */ +public final class CassandraDataCentersUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBManagedCassandraDataCenterPatch.json + */ + /** + * Sample code: CosmosDBManagedCassandraDataCenterUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBManagedCassandraDataCenterUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraDataCenters() + .update( + "cassandra-prod-rg", + "cassandra-prod", + "dc1", + new DataCenterResourceInner() + .withProperties( + new DataCenterResourceProperties() + .withDataCenterLocation("West US 2") + .withDelegatedSubnetId( + "/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/dc1-subnet") + .withNodeCount(9) + .withBase64EncodedCassandraYamlFragment( + "Y29tcGFjdGlvbl90aHJvdWdocHV0X21iX3Blcl9zZWM6IDMyCmNvbXBhY3Rpb25fbGFyZ2VfcGFydGl0aW9uX3dhcm5pbmdfdGhyZXNob2xkX21iOiAxMDA=")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesCreateUpdateCassandraKeyspaceSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesCreateUpdateCassandraKeyspaceSamples.java new file mode 100644 index 0000000000000..13729a19440da --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesCreateUpdateCassandraKeyspaceSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.CassandraKeyspaceCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.models.CassandraKeyspaceResource; +import com.azure.resourcemanager.cosmos.models.CreateUpdateOptions; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraResources CreateUpdateCassandraKeyspace. */ +public final class CassandraResourcesCreateUpdateCassandraKeyspaceSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCassandraKeyspaceCreateUpdate.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceCreateUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBCassandraKeyspaceCreateUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraResources() + .createUpdateCassandraKeyspace( + "rg1", + "ddb1", + "keyspaceName", + new CassandraKeyspaceCreateUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new CassandraKeyspaceResource().withId("keyspaceName")) + .withOptions(new CreateUpdateOptions()), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesCreateUpdateCassandraTableSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesCreateUpdateCassandraTableSamples.java new file mode 100644 index 0000000000000..fa7556eccaac8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesCreateUpdateCassandraTableSamples.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.CassandraPartitionKey; +import com.azure.resourcemanager.cosmos.models.CassandraSchema; +import com.azure.resourcemanager.cosmos.models.CassandraTableCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.models.CassandraTableResource; +import com.azure.resourcemanager.cosmos.models.ClusterKey; +import com.azure.resourcemanager.cosmos.models.Column; +import com.azure.resourcemanager.cosmos.models.CreateUpdateOptions; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraResources CreateUpdateCassandraTable. */ +public final class CassandraResourcesCreateUpdateCassandraTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCassandraTableCreateUpdate.json + */ + /** + * Sample code: CosmosDBCassandraTableCreateUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBCassandraTableCreateUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraResources() + .createUpdateCassandraTable( + "rg1", + "ddb1", + "keyspaceName", + "tableName", + new CassandraTableCreateUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource( + new CassandraTableResource() + .withId("tableName") + .withDefaultTtl(100) + .withSchema( + new CassandraSchema() + .withColumns(Arrays.asList(new Column().withName("columnA").withType("Ascii"))) + .withPartitionKeys(Arrays.asList(new CassandraPartitionKey().withName("columnA"))) + .withClusterKeys( + Arrays.asList(new ClusterKey().withName("columnA").withOrderBy("Asc"))))) + .withOptions(new CreateUpdateOptions()), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesDeleteCassandraKeyspaceSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesDeleteCassandraKeyspaceSamples.java new file mode 100644 index 0000000000000..c05658112f500 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesDeleteCassandraKeyspaceSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources DeleteCassandraKeyspace. */ +public final class CassandraResourcesDeleteCassandraKeyspaceSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCassandraKeyspaceDelete.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBCassandraKeyspaceDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraResources() + .deleteCassandraKeyspace("rg1", "ddb1", "keyspaceName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesDeleteCassandraTableSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesDeleteCassandraTableSamples.java new file mode 100644 index 0000000000000..9676d815323e0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesDeleteCassandraTableSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources DeleteCassandraTable. */ +public final class CassandraResourcesDeleteCassandraTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCassandraTableDelete.json + */ + /** + * Sample code: CosmosDBCassandraTableDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBCassandraTableDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraResources() + .deleteCassandraTable("rg1", "ddb1", "keyspaceName", "tableName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesGetCassandraKeyspaceSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesGetCassandraKeyspaceSamples.java new file mode 100644 index 0000000000000..dc91a82d512ba --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesGetCassandraKeyspaceSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources GetCassandraKeyspace. */ +public final class CassandraResourcesGetCassandraKeyspaceSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCassandraKeyspaceGet.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBCassandraKeyspaceGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraResources() + .getCassandraKeyspaceWithResponse("rg1", "ddb1", "keyspaceName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesGetCassandraKeyspaceThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesGetCassandraKeyspaceThroughputSamples.java new file mode 100644 index 0000000000000..74d1a87b1f907 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesGetCassandraKeyspaceThroughputSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources GetCassandraKeyspaceThroughput. */ +public final class CassandraResourcesGetCassandraKeyspaceThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCassandraKeyspaceThroughputGet.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceThroughputGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBCassandraKeyspaceThroughputGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraResources() + .getCassandraKeyspaceThroughputWithResponse("rg1", "ddb1", "keyspaceName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesGetCassandraTableSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesGetCassandraTableSamples.java new file mode 100644 index 0000000000000..14e6ec466e004 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesGetCassandraTableSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources GetCassandraTable. */ +public final class CassandraResourcesGetCassandraTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCassandraTableGet.json + */ + /** + * Sample code: CosmosDBCassandraTableGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBCassandraTableGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraResources() + .getCassandraTableWithResponse("rg1", "ddb1", "keyspaceName", "tableName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesGetCassandraTableThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesGetCassandraTableThroughputSamples.java new file mode 100644 index 0000000000000..0169a00ed4dd4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesGetCassandraTableThroughputSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources GetCassandraTableThroughput. */ +public final class CassandraResourcesGetCassandraTableThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCassandraTableThroughputGet.json + */ + /** + * Sample code: CosmosDBCassandraTableThroughputGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBCassandraTableThroughputGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraResources() + .getCassandraTableThroughputWithResponse("rg1", "ddb1", "keyspaceName", "tableName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesListCassandraKeyspacesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesListCassandraKeyspacesSamples.java new file mode 100644 index 0000000000000..daa33025b0a64 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesListCassandraKeyspacesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources ListCassandraKeyspaces. */ +public final class CassandraResourcesListCassandraKeyspacesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCassandraKeyspaceList.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBCassandraKeyspaceList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraResources() + .listCassandraKeyspaces("rgName", "ddb1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesListCassandraTablesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesListCassandraTablesSamples.java new file mode 100644 index 0000000000000..7774417298741 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesListCassandraTablesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources ListCassandraTables. */ +public final class CassandraResourcesListCassandraTablesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCassandraTableList.json + */ + /** + * Sample code: CosmosDBCassandraTableList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBCassandraTableList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraResources() + .listCassandraTables("rgName", "ddb1", "keyspaceName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesMigrateCassandraKeyspaceToAutoscaleSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesMigrateCassandraKeyspaceToAutoscaleSamples.java new file mode 100644 index 0000000000000..4d5703c8cd662 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesMigrateCassandraKeyspaceToAutoscaleSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources MigrateCassandraKeyspaceToAutoscale. */ +public final class CassandraResourcesMigrateCassandraKeyspaceToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCassandraKeyspaceMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceMigrateToAutoscale. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBCassandraKeyspaceMigrateToAutoscale( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraResources() + .migrateCassandraKeyspaceToAutoscale("rg1", "ddb1", "keyspaceName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesMigrateCassandraKeyspaceToManualThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesMigrateCassandraKeyspaceToManualThroughputSamples.java new file mode 100644 index 0000000000000..51833bb24aa32 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesMigrateCassandraKeyspaceToManualThroughputSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources MigrateCassandraKeyspaceToManualThroughput. */ +public final class CassandraResourcesMigrateCassandraKeyspaceToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCassandraKeyspaceMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceMigrateToManualThroughput. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBCassandraKeyspaceMigrateToManualThroughput( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraResources() + .migrateCassandraKeyspaceToManualThroughput("rg1", "ddb1", "keyspaceName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesMigrateCassandraTableToAutoscaleSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesMigrateCassandraTableToAutoscaleSamples.java new file mode 100644 index 0000000000000..1579584f8bd83 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesMigrateCassandraTableToAutoscaleSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources MigrateCassandraTableToAutoscale. */ +public final class CassandraResourcesMigrateCassandraTableToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCassandraTableMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBCassandraTableMigrateToAutoscale. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBCassandraTableMigrateToAutoscale(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraResources() + .migrateCassandraTableToAutoscale("rg1", "ddb1", "keyspaceName", "tableName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesMigrateCassandraTableToManualThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesMigrateCassandraTableToManualThroughputSamples.java new file mode 100644 index 0000000000000..5b97b576ea344 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesMigrateCassandraTableToManualThroughputSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CassandraResources MigrateCassandraTableToManualThroughput. */ +public final class CassandraResourcesMigrateCassandraTableToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCassandraTableMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBCassandraTableMigrateToManualThroughput. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBCassandraTableMigrateToManualThroughput( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraResources() + .migrateCassandraTableToManualThroughput("rg1", "ddb1", "keyspaceName", "tableName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesUpdateCassandraKeyspaceThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesUpdateCassandraKeyspaceThroughputSamples.java new file mode 100644 index 0000000000000..526f90964e281 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesUpdateCassandraKeyspaceThroughputSamples.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.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraResources UpdateCassandraKeyspaceThroughput. */ +public final class CassandraResourcesUpdateCassandraKeyspaceThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCassandraKeyspaceThroughputUpdate.json + */ + /** + * Sample code: CosmosDBCassandraKeyspaceThroughputUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBCassandraKeyspaceThroughputUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraResources() + .updateCassandraKeyspaceThroughput( + "rg1", + "ddb1", + "keyspaceName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesUpdateCassandraTableThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesUpdateCassandraTableThroughputSamples.java new file mode 100644 index 0000000000000..92b12f86680c5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CassandraResourcesUpdateCassandraTableThroughputSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CassandraResources UpdateCassandraTableThroughput. */ +public final class CassandraResourcesUpdateCassandraTableThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCassandraTableThroughputUpdate.json + */ + /** + * Sample code: CosmosDBCassandraTableThroughputUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBCassandraTableThroughputUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCassandraResources() + .updateCassandraTableThroughput( + "rg1", + "ddb1", + "keyspaceName", + "tableName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CollectionListMetricDefinitionsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CollectionListMetricDefinitionsSamples.java new file mode 100644 index 0000000000000..2bef7adb52fea --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CollectionListMetricDefinitionsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for Collection ListMetricDefinitions. */ +public final class CollectionListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCollectionGetMetricDefinitions.json + */ + /** + * Sample code: CosmosDBCollectionGetMetricDefinitions. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBCollectionGetMetricDefinitions(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCollections() + .listMetricDefinitions("rg1", "ddb1", "databaseRid", "collectionRid", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CollectionListMetricsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CollectionListMetricsSamples.java new file mode 100644 index 0000000000000..131b1d6e045a9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CollectionListMetricsSamples.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.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for Collection ListMetrics. */ +public final class CollectionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCollectionGetMetrics.json + */ + /** + * Sample code: CosmosDBCollectionGetMetrics. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBCollectionGetMetrics(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCollections() + .listMetrics( + "rg1", + "ddb1", + "databaseRid", + "collectionRid", + "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CollectionListUsagesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CollectionListUsagesSamples.java new file mode 100644 index 0000000000000..ff5116444cd1c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CollectionListUsagesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for Collection ListUsages. */ +public final class CollectionListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCollectionGetUsages.json + */ + /** + * Sample code: CosmosDBCollectionGetUsages. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBCollectionGetUsages(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCollections() + .listUsages("rg1", "ddb1", "databaseRid", "collectionRid", "$filter=name.value eq 'Storage'", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CollectionPartitionListMetricsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CollectionPartitionListMetricsSamples.java new file mode 100644 index 0000000000000..ac939e94b1619 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CollectionPartitionListMetricsSamples.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.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CollectionPartition ListMetrics. */ +public final class CollectionPartitionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCollectionPartitionGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCollectionPartitions() + .listMetrics( + "rg1", + "ddb1", + "databaseRid", + "collectionRid", + "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CollectionPartitionListUsagesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CollectionPartitionListUsagesSamples.java new file mode 100644 index 0000000000000..f177e4e0caa3f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CollectionPartitionListUsagesSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CollectionPartition ListUsages. */ +public final class CollectionPartitionListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCollectionPartitionGetUsages.json + */ + /** + * Sample code: CosmosDBCollectionGetUsages. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBCollectionGetUsages(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCollectionPartitions() + .listUsages( + "rg1", + "ddb1", + "databaseRid", + "collectionRid", + "$filter=name.value eq 'Partition Storage'", + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CollectionPartitionRegionListMetricsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CollectionPartitionRegionListMetricsSamples.java new file mode 100644 index 0000000000000..1137a1c71d18d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CollectionPartitionRegionListMetricsSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CollectionPartitionRegion ListMetrics. */ +public final class CollectionPartitionRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBCollectionPartitionRegionGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCollectionPartitionRegions() + .listMetrics( + "rg1", + "ddb1", + "North Europe", + "databaseRid", + "collectionRid", + "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CollectionRegionListMetricsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CollectionRegionListMetricsSamples.java new file mode 100644 index 0000000000000..2aded653fb317 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/CollectionRegionListMetricsSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for CollectionRegion ListMetrics. */ +public final class CollectionRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBRegionCollectionGetMetrics.json + */ + /** + * Sample code: CosmosDBRegionCollectionGetMetrics. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBRegionCollectionGetMetrics(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getCollectionRegions() + .listMetrics( + "rg1", + "ddb1", + "North Europe", + "databaseRid", + "collectionRid", + "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountRegionListMetricsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountRegionListMetricsSamples.java new file mode 100644 index 0000000000000..a4d64bc37d272 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountRegionListMetricsSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccountRegion ListMetrics. */ +public final class DatabaseAccountRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseAccountRegionGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabaseAccountRegions() + .listMetrics( + "rg1", + "ddb1", + "North Europe", + "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsCheckNameExistsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsCheckNameExistsSamples.java new file mode 100644 index 0000000000000..12370ee739c67 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsCheckNameExistsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts CheckNameExists. */ +public final class DatabaseAccountsCheckNameExistsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseAccountCheckNameExists.json + */ + /** + * Sample code: CosmosDBDatabaseAccountCheckNameExists. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountCheckNameExists(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabaseAccounts() + .checkNameExistsWithResponse("ddb1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..84f722ae1db38 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsCreateOrUpdateSamples.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.fluent.models.DatabaseRestoreResourceInner; +import com.azure.resourcemanager.cosmos.models.AnalyticalStorageConfiguration; +import com.azure.resourcemanager.cosmos.models.AnalyticalStorageSchemaType; +import com.azure.resourcemanager.cosmos.models.ApiProperties; +import com.azure.resourcemanager.cosmos.models.BackupStorageRedundancy; +import com.azure.resourcemanager.cosmos.models.Capacity; +import com.azure.resourcemanager.cosmos.models.ConsistencyPolicy; +import com.azure.resourcemanager.cosmos.models.ContinuousModeBackupPolicy; +import com.azure.resourcemanager.cosmos.models.CorsPolicy; +import com.azure.resourcemanager.cosmos.models.CreateMode; +import com.azure.resourcemanager.cosmos.models.DatabaseAccountCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.models.DatabaseAccountKind; +import com.azure.resourcemanager.cosmos.models.DefaultConsistencyLevel; +import com.azure.resourcemanager.cosmos.models.IpAddressOrRange; +import com.azure.resourcemanager.cosmos.models.Location; +import com.azure.resourcemanager.cosmos.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.models.ManagedServiceIdentityUserAssignedIdentities; +import com.azure.resourcemanager.cosmos.models.NetworkAclBypass; +import com.azure.resourcemanager.cosmos.models.PeriodicModeBackupPolicy; +import com.azure.resourcemanager.cosmos.models.PeriodicModeProperties; +import com.azure.resourcemanager.cosmos.models.PublicNetworkAccess; +import com.azure.resourcemanager.cosmos.models.ResourceIdentityType; +import com.azure.resourcemanager.cosmos.models.RestoreMode; +import com.azure.resourcemanager.cosmos.models.RestoreParameters; +import com.azure.resourcemanager.cosmos.models.ServerVersion; +import com.azure.resourcemanager.cosmos.models.VirtualNetworkRule; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DatabaseAccounts CreateOrUpdate. */ +public final class DatabaseAccountsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBRestoreDatabaseAccountCreateUpdate.json + */ + /** + * Sample code: CosmosDBRestoreDatabaseAccountCreateUpdate.json. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBRestoreDatabaseAccountCreateUpdateJson( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabaseAccounts() + .createOrUpdate( + "rg1", + "ddb1", + new DatabaseAccountCreateUpdateParameters() + .withLocation("westus") + .withTags(mapOf()) + .withKind(DatabaseAccountKind.GLOBAL_DOCUMENT_DB) + .withConsistencyPolicy( + new ConsistencyPolicy() + .withDefaultConsistencyLevel(DefaultConsistencyLevel.BOUNDED_STALENESS) + .withMaxStalenessPrefix(200L) + .withMaxIntervalInSeconds(10)) + .withLocations( + Arrays + .asList( + new Location() + .withLocationName("southcentralus") + .withFailoverPriority(0) + .withIsZoneRedundant(false))) + .withKeyVaultKeyUri("https://myKeyVault.vault.azure.net") + .withEnableFreeTier(false) + .withApiProperties(new ApiProperties().withServerVersion(ServerVersion.THREE_TWO)) + .withEnableAnalyticalStorage(true) + .withCreateMode(CreateMode.RESTORE) + .withBackupPolicy(new ContinuousModeBackupPolicy()) + .withRestoreParameters( + new RestoreParameters() + .withRestoreMode(RestoreMode.POINT_IN_TIME) + .withRestoreSource( + "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/1a97b4bb-f6a0-430e-ade1-638d781830cc") + .withRestoreTimestampInUtc(OffsetDateTime.parse("2021-03-11T22:05:09Z")) + .withDatabasesToRestore( + Arrays + .asList( + new DatabaseRestoreResourceInner() + .withDatabaseName("db1") + .withCollectionNames(Arrays.asList("collection1", "collection2")), + new DatabaseRestoreResourceInner() + .withDatabaseName("db2") + .withCollectionNames(Arrays.asList("collection3", "collection4"))))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseAccountCreateMax.json + */ + /** + * Sample code: CosmosDBDatabaseAccountCreateMax. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountCreateMax(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabaseAccounts() + .createOrUpdate( + "rg1", + "ddb1", + new DatabaseAccountCreateUpdateParameters() + .withLocation("westus") + .withTags(mapOf()) + .withKind(DatabaseAccountKind.MONGO_DB) + .withIdentity( + new ManagedServiceIdentity() + .withType(ResourceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + new ManagedServiceIdentityUserAssignedIdentities()))) + .withConsistencyPolicy( + new ConsistencyPolicy() + .withDefaultConsistencyLevel(DefaultConsistencyLevel.BOUNDED_STALENESS) + .withMaxStalenessPrefix(200L) + .withMaxIntervalInSeconds(10)) + .withLocations( + Arrays + .asList( + new Location() + .withLocationName("southcentralus") + .withFailoverPriority(0) + .withIsZoneRedundant(false), + new Location() + .withLocationName("eastus") + .withFailoverPriority(1) + .withIsZoneRedundant(false))) + .withIpRules( + Arrays + .asList( + new IpAddressOrRange().withIpAddressOrRange("23.43.230.120"), + new IpAddressOrRange().withIpAddressOrRange("110.12.240.0/12"))) + .withIsVirtualNetworkFilterEnabled(true) + .withVirtualNetworkRules( + Arrays + .asList( + new VirtualNetworkRule() + .withId( + "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1") + .withIgnoreMissingVNetServiceEndpoint(false))) + .withKeyVaultKeyUri("https://myKeyVault.vault.azure.net") + .withDefaultIdentity("FirstPartyIdentity") + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .withEnableFreeTier(false) + .withApiProperties(new ApiProperties().withServerVersion(ServerVersion.THREE_TWO)) + .withEnableAnalyticalStorage(true) + .withAnalyticalStorageConfiguration( + new AnalyticalStorageConfiguration().withSchemaType(AnalyticalStorageSchemaType.WELL_DEFINED)) + .withCreateMode(CreateMode.DEFAULT) + .withBackupPolicy( + new PeriodicModeBackupPolicy() + .withPeriodicModeProperties( + new PeriodicModeProperties() + .withBackupIntervalInMinutes(240) + .withBackupRetentionIntervalInHours(8) + .withBackupStorageRedundancy(BackupStorageRedundancy.GEO))) + .withCors(Arrays.asList(new CorsPolicy().withAllowedOrigins("https://test"))) + .withNetworkAclBypass(NetworkAclBypass.AZURE_SERVICES) + .withNetworkAclBypassResourceIds( + Arrays + .asList( + "/subscriptions/subId/resourcegroups/rgName/providers/Microsoft.Synapse/workspaces/workspaceName")) + .withCapacity(new Capacity().withTotalThroughputLimit(2000)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseAccountCreateMin.json + */ + /** + * Sample code: CosmosDBDatabaseAccountCreateMin. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountCreateMin(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabaseAccounts() + .createOrUpdate( + "rg1", + "ddb1", + new DatabaseAccountCreateUpdateParameters() + .withLocation("westus") + .withLocations( + Arrays + .asList( + new Location() + .withLocationName("southcentralus") + .withFailoverPriority(0) + .withIsZoneRedundant(false))) + .withCreateMode(CreateMode.DEFAULT), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsDeleteSamples.java new file mode 100644 index 0000000000000..f394afe880b11 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsDeleteSamples.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.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts Delete. */ +public final class DatabaseAccountsDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseAccountDelete.json + */ + /** + * Sample code: CosmosDBDatabaseAccountDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure.cosmosDBAccounts().manager().serviceClient().getDatabaseAccounts().delete("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsFailoverPriorityChangeSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsFailoverPriorityChangeSamples.java new file mode 100644 index 0000000000000..b624ac9fb612f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsFailoverPriorityChangeSamples.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.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.FailoverPolicies; +import com.azure.resourcemanager.cosmos.models.FailoverPolicy; +import java.util.Arrays; + +/** Samples for DatabaseAccounts FailoverPriorityChange. */ +public final class DatabaseAccountsFailoverPriorityChangeSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseAccountFailoverPriorityChange.json + */ + /** + * Sample code: CosmosDBDatabaseAccountFailoverPriorityChange. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountFailoverPriorityChange( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabaseAccounts() + .failoverPriorityChange( + "rg1", + "ddb1-failover", + new FailoverPolicies() + .withFailoverPolicies( + Arrays + .asList( + new FailoverPolicy().withLocationName("eastus").withFailoverPriority(0), + new FailoverPolicy().withLocationName("westus").withFailoverPriority(1))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..338467bf5071e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts GetByResourceGroup. */ +public final class DatabaseAccountsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseAccountGet.json + */ + /** + * Sample code: CosmosDBDatabaseAccountGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabaseAccounts() + .getByResourceGroupWithResponse("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsGetReadOnlyKeysSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsGetReadOnlyKeysSamples.java new file mode 100644 index 0000000000000..57c1448a9ad33 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsGetReadOnlyKeysSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts GetReadOnlyKeys. */ +public final class DatabaseAccountsGetReadOnlyKeysSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseAccountListReadOnlyKeys.json + */ + /** + * Sample code: CosmosDBDatabaseAccountListReadOnlyKeys. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountListReadOnlyKeys(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabaseAccounts() + .getReadOnlyKeysWithResponse("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..3829696b24817 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListByResourceGroupSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts ListByResourceGroup. */ +public final class DatabaseAccountsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseAccountListByResourceGroup.json + */ + /** + * Sample code: CosmosDBDatabaseAccountListByResourceGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountListByResourceGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabaseAccounts() + .listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListConnectionStringsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListConnectionStringsSamples.java new file mode 100644 index 0000000000000..762636f644230 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListConnectionStringsSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts ListConnectionStrings. */ +public final class DatabaseAccountsListConnectionStringsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseAccountListConnectionStrings.json + */ + /** + * Sample code: CosmosDBDatabaseAccountListConnectionStrings. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountListConnectionStrings( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabaseAccounts() + .listConnectionStringsWithResponse("rg1", "ddb1", Context.NONE); + } + + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseAccountListConnectionStringsMongo.json + */ + /** + * Sample code: CosmosDBDatabaseAccountListConnectionStringsMongo. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountListConnectionStringsMongo( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabaseAccounts() + .listConnectionStringsWithResponse("rg1", "mongo-ddb1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListKeysSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListKeysSamples.java new file mode 100644 index 0000000000000..aff7f8f36cddb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListKeysSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts ListKeys. */ +public final class DatabaseAccountsListKeysSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseAccountListKeys.json + */ + /** + * Sample code: CosmosDBDatabaseAccountListKeys. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountListKeys(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabaseAccounts() + .listKeysWithResponse("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListMetricDefinitionsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListMetricDefinitionsSamples.java new file mode 100644 index 0000000000000..e0b7a953c621a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListMetricDefinitionsSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts ListMetricDefinitions. */ +public final class DatabaseAccountsListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseAccountGetMetricDefinitions.json + */ + /** + * Sample code: CosmosDBDatabaseAccountGetMetricDefinitions. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountGetMetricDefinitions( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabaseAccounts() + .listMetricDefinitions("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListMetricsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListMetricsSamples.java new file mode 100644 index 0000000000000..10f73b375cbaa --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListMetricsSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts ListMetrics. */ +public final class DatabaseAccountsListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseAccountGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountGetMetrics. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountGetMetrics(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabaseAccounts() + .listMetrics( + "rg1", + "ddb1", + "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListReadOnlyKeysSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListReadOnlyKeysSamples.java new file mode 100644 index 0000000000000..c635142f2630e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListReadOnlyKeysSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts ListReadOnlyKeys. */ +public final class DatabaseAccountsListReadOnlyKeysSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseAccountListReadOnlyKeys.json + */ + /** + * Sample code: CosmosDBDatabaseAccountListReadOnlyKeys. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountListReadOnlyKeys(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabaseAccounts() + .listReadOnlyKeysWithResponse("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListSamples.java new file mode 100644 index 0000000000000..04f0051c0bb56 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListSamples.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.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts List. */ +public final class DatabaseAccountsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseAccountList.json + */ + /** + * Sample code: CosmosDBDatabaseAccountList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.cosmosDBAccounts().manager().serviceClient().getDatabaseAccounts().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListUsagesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListUsagesSamples.java new file mode 100644 index 0000000000000..6900ae25e23ea --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsListUsagesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAccounts ListUsages. */ +public final class DatabaseAccountsListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseAccountGetUsages.json + */ + /** + * Sample code: CosmosDBDatabaseAccountGetUsages. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountGetUsages(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabaseAccounts() + .listUsages("rg1", "ddb1", "$filter=name.value eq 'Storage'", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsOfflineRegionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsOfflineRegionSamples.java new file mode 100644 index 0000000000000..8d2662009ee01 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsOfflineRegionSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.RegionForOnlineOffline; + +/** Samples for DatabaseAccounts OfflineRegion. */ +public final class DatabaseAccountsOfflineRegionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseAccountOfflineRegion.json + */ + /** + * Sample code: CosmosDBDatabaseAccountOfflineRegion. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountOfflineRegion(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabaseAccounts() + .offlineRegion("rg1", "ddb1", new RegionForOnlineOffline(), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsOnlineRegionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsOnlineRegionSamples.java new file mode 100644 index 0000000000000..b1e1d5bacf630 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsOnlineRegionSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.RegionForOnlineOffline; + +/** Samples for DatabaseAccounts OnlineRegion. */ +public final class DatabaseAccountsOnlineRegionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseAccountOnlineRegion.json + */ + /** + * Sample code: CosmosDBDatabaseAccountOnlineRegion. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountOnlineRegion(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabaseAccounts() + .onlineRegion("rg1", "ddb1", new RegionForOnlineOffline(), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsRegenerateKeySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsRegenerateKeySamples.java new file mode 100644 index 0000000000000..7dfdffd6ef3c3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsRegenerateKeySamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.DatabaseAccountRegenerateKeyParameters; +import com.azure.resourcemanager.cosmos.models.KeyKind; + +/** Samples for DatabaseAccounts RegenerateKey. */ +public final class DatabaseAccountsRegenerateKeySamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseAccountRegenerateKey.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegenerateKey. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountRegenerateKey(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabaseAccounts() + .regenerateKey( + "rg1", "ddb1", new DatabaseAccountRegenerateKeyParameters().withKeyKind(KeyKind.PRIMARY), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsUpdateSamples.java new file mode 100644 index 0000000000000..d223e05f7798d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseAccountsUpdateSamples.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.AnalyticalStorageConfiguration; +import com.azure.resourcemanager.cosmos.models.AnalyticalStorageSchemaType; +import com.azure.resourcemanager.cosmos.models.BackupStorageRedundancy; +import com.azure.resourcemanager.cosmos.models.Capacity; +import com.azure.resourcemanager.cosmos.models.ConsistencyPolicy; +import com.azure.resourcemanager.cosmos.models.DatabaseAccountUpdateParameters; +import com.azure.resourcemanager.cosmos.models.DefaultConsistencyLevel; +import com.azure.resourcemanager.cosmos.models.IpAddressOrRange; +import com.azure.resourcemanager.cosmos.models.ManagedServiceIdentity; +import com.azure.resourcemanager.cosmos.models.ManagedServiceIdentityUserAssignedIdentities; +import com.azure.resourcemanager.cosmos.models.NetworkAclBypass; +import com.azure.resourcemanager.cosmos.models.PeriodicModeBackupPolicy; +import com.azure.resourcemanager.cosmos.models.PeriodicModeProperties; +import com.azure.resourcemanager.cosmos.models.ResourceIdentityType; +import com.azure.resourcemanager.cosmos.models.VirtualNetworkRule; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DatabaseAccounts Update. */ +public final class DatabaseAccountsUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseAccountPatch.json + */ + /** + * Sample code: CosmosDBDatabaseAccountPatch. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountPatch(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabaseAccounts() + .update( + "rg1", + "ddb1", + new DatabaseAccountUpdateParameters() + .withTags(mapOf("dept", "finance")) + .withLocation("westus") + .withIdentity( + new ManagedServiceIdentity() + .withType(ResourceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + new ManagedServiceIdentityUserAssignedIdentities()))) + .withConsistencyPolicy( + new ConsistencyPolicy() + .withDefaultConsistencyLevel(DefaultConsistencyLevel.BOUNDED_STALENESS) + .withMaxStalenessPrefix(200L) + .withMaxIntervalInSeconds(10)) + .withIpRules( + Arrays + .asList( + new IpAddressOrRange().withIpAddressOrRange("23.43.230.120"), + new IpAddressOrRange().withIpAddressOrRange("110.12.240.0/12"))) + .withIsVirtualNetworkFilterEnabled(true) + .withVirtualNetworkRules( + Arrays + .asList( + new VirtualNetworkRule() + .withId( + "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1") + .withIgnoreMissingVNetServiceEndpoint(false))) + .withDefaultIdentity("FirstPartyIdentity") + .withEnableFreeTier(false) + .withEnableAnalyticalStorage(true) + .withAnalyticalStorageConfiguration( + new AnalyticalStorageConfiguration().withSchemaType(AnalyticalStorageSchemaType.WELL_DEFINED)) + .withBackupPolicy( + new PeriodicModeBackupPolicy() + .withPeriodicModeProperties( + new PeriodicModeProperties() + .withBackupIntervalInMinutes(240) + .withBackupRetentionIntervalInHours(720) + .withBackupStorageRedundancy(BackupStorageRedundancy.LOCAL))) + .withNetworkAclBypass(NetworkAclBypass.AZURE_SERVICES) + .withNetworkAclBypassResourceIds( + Arrays + .asList( + "/subscriptions/subId/resourcegroups/rgName/providers/Microsoft.Synapse/workspaces/workspaceName")) + .withCapacity(new Capacity().withTotalThroughputLimit(2000)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseListMetricDefinitionsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseListMetricDefinitionsSamples.java new file mode 100644 index 0000000000000..5b0f094d1ccd1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseListMetricDefinitionsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for Database ListMetricDefinitions. */ +public final class DatabaseListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseGetMetricDefinitions.json + */ + /** + * Sample code: CosmosDBDatabaseGetMetricDefinitions. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseGetMetricDefinitions(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabases() + .listMetricDefinitions("rg1", "ddb1", "databaseRid", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseListMetricsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseListMetricsSamples.java new file mode 100644 index 0000000000000..0fa4092157201 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseListMetricsSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for Database ListMetrics. */ +public final class DatabaseListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseGetMetrics. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseGetMetrics(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabases() + .listMetrics( + "rg1", + "ddb1", + "rid", + "$filter=(name.value eq 'Total Requests') and timeGrain eq duration'PT5M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseListUsagesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseListUsagesSamples.java new file mode 100644 index 0000000000000..ab8f07b98d136 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/DatabaseListUsagesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for Database ListUsages. */ +public final class DatabaseListUsagesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBDatabaseGetUsages.json + */ + /** + * Sample code: CosmosDBDatabaseGetUsages. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseGetUsages(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getDatabases() + .listUsages("rg1", "ddb1", "databaseRid", "$filter=name.value eq 'Storage'", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesCreateUpdateGremlinDatabaseSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesCreateUpdateGremlinDatabaseSamples.java new file mode 100644 index 0000000000000..ae1905b4a2ff4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesCreateUpdateGremlinDatabaseSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.models.GremlinDatabaseCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.models.GremlinDatabaseResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for GremlinResources CreateUpdateGremlinDatabase. */ +public final class GremlinResourcesCreateUpdateGremlinDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBGremlinDatabaseCreateUpdate.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseCreateUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBGremlinDatabaseCreateUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getGremlinResources() + .createUpdateGremlinDatabase( + "rg1", + "ddb1", + "databaseName", + new GremlinDatabaseCreateUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new GremlinDatabaseResource().withId("databaseName")) + .withOptions(new CreateUpdateOptions()), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesCreateUpdateGremlinGraphSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesCreateUpdateGremlinGraphSamples.java new file mode 100644 index 0000000000000..f1036bb1f7378 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesCreateUpdateGremlinGraphSamples.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.ConflictResolutionMode; +import com.azure.resourcemanager.cosmos.models.ConflictResolutionPolicy; +import com.azure.resourcemanager.cosmos.models.ContainerPartitionKey; +import com.azure.resourcemanager.cosmos.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.models.DataType; +import com.azure.resourcemanager.cosmos.models.GremlinGraphCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.models.GremlinGraphResource; +import com.azure.resourcemanager.cosmos.models.IncludedPath; +import com.azure.resourcemanager.cosmos.models.IndexKind; +import com.azure.resourcemanager.cosmos.models.Indexes; +import com.azure.resourcemanager.cosmos.models.IndexingMode; +import com.azure.resourcemanager.cosmos.models.IndexingPolicy; +import com.azure.resourcemanager.cosmos.models.PartitionKind; +import com.azure.resourcemanager.cosmos.models.UniqueKey; +import com.azure.resourcemanager.cosmos.models.UniqueKeyPolicy; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for GremlinResources CreateUpdateGremlinGraph. */ +public final class GremlinResourcesCreateUpdateGremlinGraphSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBGremlinGraphCreateUpdate.json + */ + /** + * Sample code: CosmosDBGremlinGraphCreateUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBGremlinGraphCreateUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getGremlinResources() + .createUpdateGremlinGraph( + "rg1", + "ddb1", + "databaseName", + "graphName", + new GremlinGraphCreateUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource( + new GremlinGraphResource() + .withId("graphName") + .withIndexingPolicy( + new IndexingPolicy() + .withAutomatic(true) + .withIndexingMode(IndexingMode.CONSISTENT) + .withIncludedPaths( + Arrays + .asList( + new IncludedPath() + .withPath("/*") + .withIndexes( + Arrays + .asList( + new Indexes() + .withDataType(DataType.STRING) + .withPrecision(-1) + .withKind(IndexKind.RANGE), + new Indexes() + .withDataType(DataType.NUMBER) + .withPrecision(-1) + .withKind(IndexKind.RANGE))))) + .withExcludedPaths(Arrays.asList())) + .withPartitionKey( + new ContainerPartitionKey() + .withPaths(Arrays.asList("/AccountNumber")) + .withKind(PartitionKind.HASH)) + .withDefaultTtl(100) + .withUniqueKeyPolicy( + new UniqueKeyPolicy() + .withUniqueKeys( + Arrays.asList(new UniqueKey().withPaths(Arrays.asList("/testPath"))))) + .withConflictResolutionPolicy( + new ConflictResolutionPolicy() + .withMode(ConflictResolutionMode.LAST_WRITER_WINS) + .withConflictResolutionPath("/path"))) + .withOptions(new CreateUpdateOptions()), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesDeleteGremlinDatabaseSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesDeleteGremlinDatabaseSamples.java new file mode 100644 index 0000000000000..628cc49c26e7a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesDeleteGremlinDatabaseSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources DeleteGremlinDatabase. */ +public final class GremlinResourcesDeleteGremlinDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBGremlinDatabaseDelete.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBGremlinDatabaseDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getGremlinResources() + .deleteGremlinDatabase("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesDeleteGremlinGraphSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesDeleteGremlinGraphSamples.java new file mode 100644 index 0000000000000..ca75ba0dce0d6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesDeleteGremlinGraphSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources DeleteGremlinGraph. */ +public final class GremlinResourcesDeleteGremlinGraphSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBGremlinGraphDelete.json + */ + /** + * Sample code: CosmosDBGremlinGraphDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBGremlinGraphDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getGremlinResources() + .deleteGremlinGraph("rg1", "ddb1", "databaseName", "graphName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesGetGremlinDatabaseSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesGetGremlinDatabaseSamples.java new file mode 100644 index 0000000000000..e650562d8ad5b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesGetGremlinDatabaseSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources GetGremlinDatabase. */ +public final class GremlinResourcesGetGremlinDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBGremlinDatabaseGet.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBGremlinDatabaseGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getGremlinResources() + .getGremlinDatabaseWithResponse("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesGetGremlinDatabaseThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesGetGremlinDatabaseThroughputSamples.java new file mode 100644 index 0000000000000..5681b86a0f6af --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesGetGremlinDatabaseThroughputSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources GetGremlinDatabaseThroughput. */ +public final class GremlinResourcesGetGremlinDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBGremlinDatabaseThroughputGet.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseThroughputGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBGremlinDatabaseThroughputGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getGremlinResources() + .getGremlinDatabaseThroughputWithResponse("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesGetGremlinGraphSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesGetGremlinGraphSamples.java new file mode 100644 index 0000000000000..8c2ace836982f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesGetGremlinGraphSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources GetGremlinGraph. */ +public final class GremlinResourcesGetGremlinGraphSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBGremlinGraphGet.json + */ + /** + * Sample code: CosmosDBGremlinGraphGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBGremlinGraphGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getGremlinResources() + .getGremlinGraphWithResponse("rgName", "ddb1", "databaseName", "graphName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesGetGremlinGraphThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesGetGremlinGraphThroughputSamples.java new file mode 100644 index 0000000000000..658f23d8f2da9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesGetGremlinGraphThroughputSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources GetGremlinGraphThroughput. */ +public final class GremlinResourcesGetGremlinGraphThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBGremlinGraphThroughputGet.json + */ + /** + * Sample code: CosmosDBGremlinGraphThroughputGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBGremlinGraphThroughputGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getGremlinResources() + .getGremlinGraphThroughputWithResponse("rg1", "ddb1", "databaseName", "graphName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesListGremlinDatabasesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesListGremlinDatabasesSamples.java new file mode 100644 index 0000000000000..21288fcf065c1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesListGremlinDatabasesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources ListGremlinDatabases. */ +public final class GremlinResourcesListGremlinDatabasesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBGremlinDatabaseList.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBGremlinDatabaseList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getGremlinResources() + .listGremlinDatabases("rgName", "ddb1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesListGremlinGraphsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesListGremlinGraphsSamples.java new file mode 100644 index 0000000000000..9f05e0e7ef2d9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesListGremlinGraphsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources ListGremlinGraphs. */ +public final class GremlinResourcesListGremlinGraphsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBGremlinGraphList.json + */ + /** + * Sample code: CosmosDBGremlinGraphList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBGremlinGraphList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getGremlinResources() + .listGremlinGraphs("rgName", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesMigrateGremlinDatabaseToAutoscaleSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesMigrateGremlinDatabaseToAutoscaleSamples.java new file mode 100644 index 0000000000000..2069e7d82acf9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesMigrateGremlinDatabaseToAutoscaleSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources MigrateGremlinDatabaseToAutoscale. */ +public final class GremlinResourcesMigrateGremlinDatabaseToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBGremlinDatabaseMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseMigrateToAutoscale. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBGremlinDatabaseMigrateToAutoscale(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getGremlinResources() + .migrateGremlinDatabaseToAutoscale("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesMigrateGremlinDatabaseToManualThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesMigrateGremlinDatabaseToManualThroughputSamples.java new file mode 100644 index 0000000000000..65cf083acc136 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesMigrateGremlinDatabaseToManualThroughputSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources MigrateGremlinDatabaseToManualThroughput. */ +public final class GremlinResourcesMigrateGremlinDatabaseToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBGremlinDatabaseMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseMigrateToManualThroughput. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBGremlinDatabaseMigrateToManualThroughput( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getGremlinResources() + .migrateGremlinDatabaseToManualThroughput("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesMigrateGremlinGraphToAutoscaleSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesMigrateGremlinGraphToAutoscaleSamples.java new file mode 100644 index 0000000000000..99cf7e0113320 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesMigrateGremlinGraphToAutoscaleSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources MigrateGremlinGraphToAutoscale. */ +public final class GremlinResourcesMigrateGremlinGraphToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBGremlinGraphMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBGremlinGraphMigrateToAutoscale. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBGremlinGraphMigrateToAutoscale(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getGremlinResources() + .migrateGremlinGraphToAutoscale("rg1", "ddb1", "databaseName", "graphName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesMigrateGremlinGraphToManualThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesMigrateGremlinGraphToManualThroughputSamples.java new file mode 100644 index 0000000000000..b7569e40c3a63 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesMigrateGremlinGraphToManualThroughputSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for GremlinResources MigrateGremlinGraphToManualThroughput. */ +public final class GremlinResourcesMigrateGremlinGraphToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBGremlinGraphMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBGremlinGraphMigrateToManualThroughput. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBGremlinGraphMigrateToManualThroughput( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getGremlinResources() + .migrateGremlinGraphToManualThroughput("rg1", "ddb1", "databaseName", "graphName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesUpdateGremlinDatabaseThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesUpdateGremlinDatabaseThroughputSamples.java new file mode 100644 index 0000000000000..7df874449da1f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesUpdateGremlinDatabaseThroughputSamples.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.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for GremlinResources UpdateGremlinDatabaseThroughput. */ +public final class GremlinResourcesUpdateGremlinDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBGremlinDatabaseThroughputUpdate.json + */ + /** + * Sample code: CosmosDBGremlinDatabaseThroughputUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBGremlinDatabaseThroughputUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getGremlinResources() + .updateGremlinDatabaseThroughput( + "rg1", + "ddb1", + "databaseName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesUpdateGremlinGraphThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesUpdateGremlinGraphThroughputSamples.java new file mode 100644 index 0000000000000..3bd7a8dc0dfe3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/GremlinResourcesUpdateGremlinGraphThroughputSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for GremlinResources UpdateGremlinGraphThroughput. */ +public final class GremlinResourcesUpdateGremlinGraphThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBGremlinGraphThroughputUpdate.json + */ + /** + * Sample code: CosmosDBGremlinGraphThroughputUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBGremlinGraphThroughputUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getGremlinResources() + .updateGremlinGraphThroughput( + "rg1", + "ddb1", + "databaseName", + "graphName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/LocationsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/LocationsGetSamples.java new file mode 100644 index 0000000000000..7080c6f3ab430 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/LocationsGetSamples.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.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for Locations Get. */ +public final class LocationsGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBLocationGet.json + */ + /** + * Sample code: CosmosDBLocationGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBLocationGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure.cosmosDBAccounts().manager().serviceClient().getLocations().getWithResponse("westus", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/LocationsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/LocationsListSamples.java new file mode 100644 index 0000000000000..30d693a9eb9c1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/LocationsListSamples.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.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for Locations List. */ +public final class LocationsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBLocationList.json + */ + /** + * Sample code: CosmosDBLocationList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBLocationList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.cosmosDBAccounts().manager().serviceClient().getLocations().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesCreateUpdateMongoDBCollectionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesCreateUpdateMongoDBCollectionSamples.java new file mode 100644 index 0000000000000..656af204264c0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesCreateUpdateMongoDBCollectionSamples.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.models.MongoDBCollectionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.models.MongoDBCollectionResource; +import com.azure.resourcemanager.cosmos.models.MongoIndex; +import com.azure.resourcemanager.cosmos.models.MongoIndexKeys; +import com.azure.resourcemanager.cosmos.models.MongoIndexOptions; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for MongoDBResources CreateUpdateMongoDBCollection. */ +public final class MongoDBResourcesCreateUpdateMongoDBCollectionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBMongoDBCollectionCreateUpdate.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionCreateUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBMongoDBCollectionCreateUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getMongoDBResources() + .createUpdateMongoDBCollection( + "rg1", + "ddb1", + "databaseName", + "collectionName", + new MongoDBCollectionCreateUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource( + new MongoDBCollectionResource() + .withId("collectionName") + .withShardKey(mapOf("testKey", "Hash")) + .withIndexes( + Arrays + .asList( + new MongoIndex() + .withKey(new MongoIndexKeys().withKeys(Arrays.asList("_ts"))) + .withOptions( + new MongoIndexOptions().withExpireAfterSeconds(100).withUnique(true)), + new MongoIndex().withKey(new MongoIndexKeys().withKeys(Arrays.asList("_id")))))) + .withOptions(new CreateUpdateOptions()), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesCreateUpdateMongoDBDatabaseSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesCreateUpdateMongoDBDatabaseSamples.java new file mode 100644 index 0000000000000..9a3aabf29354b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesCreateUpdateMongoDBDatabaseSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.models.MongoDBDatabaseCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.models.MongoDBDatabaseResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for MongoDBResources CreateUpdateMongoDBDatabase. */ +public final class MongoDBResourcesCreateUpdateMongoDBDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBMongoDBDatabaseCreateUpdate.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseCreateUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBMongoDBDatabaseCreateUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getMongoDBResources() + .createUpdateMongoDBDatabase( + "rg1", + "ddb1", + "databaseName", + new MongoDBDatabaseCreateUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new MongoDBDatabaseResource().withId("databaseName")) + .withOptions(new CreateUpdateOptions()), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesDeleteMongoDBCollectionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesDeleteMongoDBCollectionSamples.java new file mode 100644 index 0000000000000..7ffdddf15aabf --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesDeleteMongoDBCollectionSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources DeleteMongoDBCollection. */ +public final class MongoDBResourcesDeleteMongoDBCollectionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBMongoDBCollectionDelete.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBMongoDBCollectionDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getMongoDBResources() + .deleteMongoDBCollection("rg1", "ddb1", "databaseName", "collectionName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesDeleteMongoDBDatabaseSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesDeleteMongoDBDatabaseSamples.java new file mode 100644 index 0000000000000..d35432a28d968 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesDeleteMongoDBDatabaseSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources DeleteMongoDBDatabase. */ +public final class MongoDBResourcesDeleteMongoDBDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBMongoDBDatabaseDelete.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBMongoDBDatabaseDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getMongoDBResources() + .deleteMongoDBDatabase("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesGetMongoDBCollectionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesGetMongoDBCollectionSamples.java new file mode 100644 index 0000000000000..96234d19f2609 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesGetMongoDBCollectionSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources GetMongoDBCollection. */ +public final class MongoDBResourcesGetMongoDBCollectionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBMongoDBCollectionGet.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBMongoDBCollectionGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getMongoDBResources() + .getMongoDBCollectionWithResponse("rgName", "ddb1", "databaseName", "collectionName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesGetMongoDBCollectionThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesGetMongoDBCollectionThroughputSamples.java new file mode 100644 index 0000000000000..47f1d6ca5b833 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesGetMongoDBCollectionThroughputSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources GetMongoDBCollectionThroughput. */ +public final class MongoDBResourcesGetMongoDBCollectionThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBMongoDBCollectionThroughputGet.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionThroughputGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBMongoDBCollectionThroughputGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getMongoDBResources() + .getMongoDBCollectionThroughputWithResponse("rg1", "ddb1", "databaseName", "collectionName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesGetMongoDBDatabaseSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesGetMongoDBDatabaseSamples.java new file mode 100644 index 0000000000000..24c5bb65863ec --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesGetMongoDBDatabaseSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources GetMongoDBDatabase. */ +public final class MongoDBResourcesGetMongoDBDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBMongoDBDatabaseGet.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBMongoDBDatabaseGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getMongoDBResources() + .getMongoDBDatabaseWithResponse("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesGetMongoDBDatabaseThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesGetMongoDBDatabaseThroughputSamples.java new file mode 100644 index 0000000000000..52ace9d39867a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesGetMongoDBDatabaseThroughputSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources GetMongoDBDatabaseThroughput. */ +public final class MongoDBResourcesGetMongoDBDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBMongoDBDatabaseThroughputGet.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseThroughputGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBMongoDBDatabaseThroughputGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getMongoDBResources() + .getMongoDBDatabaseThroughputWithResponse("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesListMongoDBCollectionsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesListMongoDBCollectionsSamples.java new file mode 100644 index 0000000000000..f877ec746626a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesListMongoDBCollectionsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources ListMongoDBCollections. */ +public final class MongoDBResourcesListMongoDBCollectionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBMongoDBCollectionList.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBMongoDBCollectionList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getMongoDBResources() + .listMongoDBCollections("rgName", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesListMongoDBDatabasesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesListMongoDBDatabasesSamples.java new file mode 100644 index 0000000000000..2c5d2d419590e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesListMongoDBDatabasesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources ListMongoDBDatabases. */ +public final class MongoDBResourcesListMongoDBDatabasesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBMongoDBDatabaseList.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBMongoDBDatabaseList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getMongoDBResources() + .listMongoDBDatabases("rgName", "ddb1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesMigrateMongoDBCollectionToAutoscaleSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesMigrateMongoDBCollectionToAutoscaleSamples.java new file mode 100644 index 0000000000000..f66ee83209658 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesMigrateMongoDBCollectionToAutoscaleSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources MigrateMongoDBCollectionToAutoscale. */ +public final class MongoDBResourcesMigrateMongoDBCollectionToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBMongoDBCollectionMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionMigrateToAutoscale. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBMongoDBCollectionMigrateToAutoscale( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getMongoDBResources() + .migrateMongoDBCollectionToAutoscale("rg1", "ddb1", "databaseName", "collectionName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesMigrateMongoDBCollectionToManualThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesMigrateMongoDBCollectionToManualThroughputSamples.java new file mode 100644 index 0000000000000..a6dcffafffb34 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesMigrateMongoDBCollectionToManualThroughputSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources MigrateMongoDBCollectionToManualThroughput. */ +public final class MongoDBResourcesMigrateMongoDBCollectionToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBMongoDBCollectionMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionMigrateToManualThroughput. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBMongoDBCollectionMigrateToManualThroughput( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getMongoDBResources() + .migrateMongoDBCollectionToManualThroughput("rg1", "ddb1", "databaseName", "collectionName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleSamples.java new file mode 100644 index 0000000000000..68b02a424c7c2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources MigrateMongoDBDatabaseToAutoscale. */ +public final class MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBMongoDBDatabaseMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseMigrateToAutoscale. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBMongoDBDatabaseMigrateToAutoscale(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getMongoDBResources() + .migrateMongoDBDatabaseToAutoscale("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputSamples.java new file mode 100644 index 0000000000000..a532afe2dc789 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for MongoDBResources MigrateMongoDBDatabaseToManualThroughput. */ +public final class MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBMongoDBDatabaseMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseMigrateToManualThroughput. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBMongoDBDatabaseMigrateToManualThroughput( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getMongoDBResources() + .migrateMongoDBDatabaseToManualThroughput("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesRetrieveContinuousBackupInformationSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesRetrieveContinuousBackupInformationSamples.java new file mode 100644 index 0000000000000..79eadc5dd0335 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesRetrieveContinuousBackupInformationSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.ContinuousBackupRestoreLocation; + +/** Samples for MongoDBResources RetrieveContinuousBackupInformation. */ +public final class MongoDBResourcesRetrieveContinuousBackupInformationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBMongoDBCollectionBackupInformation.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionBackupInformation. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBMongoDBCollectionBackupInformation( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getMongoDBResources() + .retrieveContinuousBackupInformation( + "rgName", + "ddb1", + "databaseName", + "collectionName", + new ContinuousBackupRestoreLocation().withLocation("North Europe"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesUpdateMongoDBCollectionThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesUpdateMongoDBCollectionThroughputSamples.java new file mode 100644 index 0000000000000..8540932042e66 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesUpdateMongoDBCollectionThroughputSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for MongoDBResources UpdateMongoDBCollectionThroughput. */ +public final class MongoDBResourcesUpdateMongoDBCollectionThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBMongoDBCollectionThroughputUpdate.json + */ + /** + * Sample code: CosmosDBMongoDBCollectionThroughputUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBMongoDBCollectionThroughputUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getMongoDBResources() + .updateMongoDBCollectionThroughput( + "rg1", + "ddb1", + "databaseName", + "collectionName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesUpdateMongoDBDatabaseThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesUpdateMongoDBDatabaseThroughputSamples.java new file mode 100644 index 0000000000000..1e42795966226 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/MongoDBResourcesUpdateMongoDBDatabaseThroughputSamples.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.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for MongoDBResources UpdateMongoDBDatabaseThroughput. */ +public final class MongoDBResourcesUpdateMongoDBDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBMongoDBDatabaseThroughputUpdate.json + */ + /** + * Sample code: CosmosDBMongoDBDatabaseThroughputUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBMongoDBDatabaseThroughputUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getMongoDBResources() + .updateMongoDBDatabaseThroughput( + "rg1", + "ddb1", + "databaseName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/NotebookWorkspacesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/NotebookWorkspacesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e06d34d8c9354 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/NotebookWorkspacesCreateOrUpdateSamples.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.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.NotebookWorkspaceCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.models.NotebookWorkspaceName; + +/** Samples for NotebookWorkspaces CreateOrUpdate. */ +public final class NotebookWorkspacesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBNotebookWorkspaceCreate.json + */ + /** + * Sample code: CosmosDBNotebookWorkspaceCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBNotebookWorkspaceCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getNotebookWorkspaces() + .createOrUpdate( + "rg1", + "ddb1", + NotebookWorkspaceName.DEFAULT, + new NotebookWorkspaceCreateUpdateParameters(), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/NotebookWorkspacesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/NotebookWorkspacesDeleteSamples.java new file mode 100644 index 0000000000000..5be5939ff5885 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/NotebookWorkspacesDeleteSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.NotebookWorkspaceName; + +/** Samples for NotebookWorkspaces Delete. */ +public final class NotebookWorkspacesDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBNotebookWorkspaceDelete.json + */ + /** + * Sample code: CosmosDBNotebookWorkspaceDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBNotebookWorkspaceDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getNotebookWorkspaces() + .delete("rg1", "ddb1", NotebookWorkspaceName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/NotebookWorkspacesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/NotebookWorkspacesGetSamples.java new file mode 100644 index 0000000000000..41291c91eeab4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/NotebookWorkspacesGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.NotebookWorkspaceName; + +/** Samples for NotebookWorkspaces Get. */ +public final class NotebookWorkspacesGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBNotebookWorkspaceGet.json + */ + /** + * Sample code: CosmosDBNotebookWorkspaceGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBNotebookWorkspaceGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getNotebookWorkspaces() + .getWithResponse("rg1", "ddb1", NotebookWorkspaceName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/NotebookWorkspacesListByDatabaseAccountSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/NotebookWorkspacesListByDatabaseAccountSamples.java new file mode 100644 index 0000000000000..4d9462fa5ef1b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/NotebookWorkspacesListByDatabaseAccountSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for NotebookWorkspaces ListByDatabaseAccount. */ +public final class NotebookWorkspacesListByDatabaseAccountSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBNotebookWorkspaceList.json + */ + /** + * Sample code: CosmosDBNotebookWorkspaceList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBNotebookWorkspaceList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getNotebookWorkspaces() + .listByDatabaseAccount("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/NotebookWorkspacesListConnectionInfoSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/NotebookWorkspacesListConnectionInfoSamples.java new file mode 100644 index 0000000000000..db2bacd31d0b6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/NotebookWorkspacesListConnectionInfoSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.NotebookWorkspaceName; + +/** Samples for NotebookWorkspaces ListConnectionInfo. */ +public final class NotebookWorkspacesListConnectionInfoSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBNotebookWorkspaceListConnectionInfo.json + */ + /** + * Sample code: CosmosDBNotebookWorkspaceListConnectionInfo. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBNotebookWorkspaceListConnectionInfo( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getNotebookWorkspaces() + .listConnectionInfoWithResponse("rg1", "ddb1", NotebookWorkspaceName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/NotebookWorkspacesRegenerateAuthTokenSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/NotebookWorkspacesRegenerateAuthTokenSamples.java new file mode 100644 index 0000000000000..5730229bb8bc4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/NotebookWorkspacesRegenerateAuthTokenSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.NotebookWorkspaceName; + +/** Samples for NotebookWorkspaces RegenerateAuthToken. */ +public final class NotebookWorkspacesRegenerateAuthTokenSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBNotebookWorkspaceRegenerateAuthToken.json + */ + /** + * Sample code: CosmosDBNotebookWorkspaceRegenerateAuthToken. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBNotebookWorkspaceRegenerateAuthToken( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getNotebookWorkspaces() + .regenerateAuthToken("rg1", "ddb1", NotebookWorkspaceName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/NotebookWorkspacesStartSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/NotebookWorkspacesStartSamples.java new file mode 100644 index 0000000000000..389ec8ef38498 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/NotebookWorkspacesStartSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.NotebookWorkspaceName; + +/** Samples for NotebookWorkspaces Start. */ +public final class NotebookWorkspacesStartSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBNotebookWorkspaceStart.json + */ + /** + * Sample code: CosmosDBNotebookWorkspaceStart. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBNotebookWorkspaceStart(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getNotebookWorkspaces() + .start("rg1", "ddb1", NotebookWorkspaceName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/OperationsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..1c3effc26df63 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBOperationsList.json + */ + /** + * Sample code: CosmosDBOperationsList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBOperationsList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.cosmosDBAccounts().manager().serviceClient().getOperations().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PartitionKeyRangeIdListMetricsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PartitionKeyRangeIdListMetricsSamples.java new file mode 100644 index 0000000000000..4f68dbf722298 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PartitionKeyRangeIdListMetricsSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for PartitionKeyRangeId ListMetrics. */ +public final class PartitionKeyRangeIdListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBPKeyRangeIdGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getPartitionKeyRangeIds() + .listMetrics( + "rg1", + "ddb1", + "databaseRid", + "collectionRid", + "0", + "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PartitionKeyRangeIdRegionListMetricsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PartitionKeyRangeIdRegionListMetricsSamples.java new file mode 100644 index 0000000000000..fbfda56178827 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PartitionKeyRangeIdRegionListMetricsSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for PartitionKeyRangeIdRegion ListMetrics. */ +public final class PartitionKeyRangeIdRegionListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBPKeyRangeIdRegionGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getPartitionKeyRangeIdRegions() + .listMetrics( + "rg1", + "ddb1", + "West US", + "databaseRid", + "collectionRid", + "0", + "$filter=(name.value eq 'Max RUs Per Second') and timeGrain eq duration'PT1M' and startTime eq" + + " '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T23:58:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PercentileListMetricsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PercentileListMetricsSamples.java new file mode 100644 index 0000000000000..c3d9719afd3d3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PercentileListMetricsSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for Percentile ListMetrics. */ +public final class PercentileListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBPercentileGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getPercentiles() + .listMetrics( + "rg1", + "ddb1", + "$filter=(name.value eq 'Probabilistic Bounded Staleness') and timeGrain eq duration'PT5M' and" + + " startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PercentileSourceTargetListMetricsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PercentileSourceTargetListMetricsSamples.java new file mode 100644 index 0000000000000..9e1b6f4f41210 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PercentileSourceTargetListMetricsSamples.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.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for PercentileSourceTarget ListMetrics. */ +public final class PercentileSourceTargetListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBPercentileSourceTargetGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getPercentileSourceTargets() + .listMetrics( + "rg1", + "ddb1", + "West Central US", + "East US", + "$filter=(name.value eq 'Probabilistic Bounded Staleness') and timeGrain eq duration'PT5M' and" + + " startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PercentileTargetListMetricsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PercentileTargetListMetricsSamples.java new file mode 100644 index 0000000000000..398739d6bb2e2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PercentileTargetListMetricsSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for PercentileTarget ListMetrics. */ +public final class PercentileTargetListMetricsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBPercentileTargetGetMetrics.json + */ + /** + * Sample code: CosmosDBDatabaseAccountRegionGetMetrics. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBDatabaseAccountRegionGetMetrics(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getPercentileTargets() + .listMetrics( + "rg1", + "ddb1", + "East US", + "$filter=(name.value eq 'Probabilistic Bounded Staleness') and timeGrain eq duration'PT5M' and" + + " startTime eq '2017-11-19T23:53:55.2780000Z' and endTime eq '2017-11-20T00:13:55.2780000Z", + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e2151d23bba93 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.cosmos.models.PrivateLinkServiceConnectionStateProperty; + +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBPrivateEndpointConnectionUpdate.json + */ + /** + * Sample code: Approve or reject a private endpoint connection with a given name. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + "rg1", + "ddb1", + "privateEndpointConnectionName", + new PrivateEndpointConnectionInner() + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionStateProperty() + .withStatus("Approved") + .withDescription("Approved by johndoe@contoso.com")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..a94fc96a042f2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PrivateEndpointConnectionsDeleteSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBPrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Deletes a private endpoint connection with a given name. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getPrivateEndpointConnections() + .delete("rg1", "ddb1", "privateEndpointConnectionName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PrivateEndpointConnectionsGetSamples.java new file mode 100644 index 0000000000000..65ede129593ca --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PrivateEndpointConnectionsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBPrivateEndpointConnectionGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getsPrivateEndpointConnection(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse("rg1", "ddb1", "privateEndpointConnectionName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PrivateEndpointConnectionsListByDatabaseAccountSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PrivateEndpointConnectionsListByDatabaseAccountSamples.java new file mode 100644 index 0000000000000..b7fb7fbe1d99e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PrivateEndpointConnectionsListByDatabaseAccountSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections ListByDatabaseAccount. */ +public final class PrivateEndpointConnectionsListByDatabaseAccountSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBPrivateEndpointConnectionListGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getsPrivateEndpointConnection(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getPrivateEndpointConnections() + .listByDatabaseAccount("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PrivateLinkResourcesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PrivateLinkResourcesGetSamples.java new file mode 100644 index 0000000000000..e1853fa446410 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PrivateLinkResourcesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources Get. */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBPrivateLinkResourceGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getsPrivateEndpointConnection(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getPrivateLinkResources() + .getWithResponse("rg1", "ddb1", "sql", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PrivateLinkResourcesListByDatabaseAccountSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PrivateLinkResourcesListByDatabaseAccountSamples.java new file mode 100644 index 0000000000000..dd4b6fcf965c2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/PrivateLinkResourcesListByDatabaseAccountSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources ListByDatabaseAccount. */ +public final class PrivateLinkResourcesListByDatabaseAccountSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBPrivateLinkResourceListGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getsPrivateEndpointConnection(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getPrivateLinkResources() + .listByDatabaseAccount("rg1", "ddb1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableDatabaseAccountsGetByLocationSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableDatabaseAccountsGetByLocationSamples.java new file mode 100644 index 0000000000000..1c7b3da82e3cb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableDatabaseAccountsGetByLocationSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableDatabaseAccounts GetByLocation. */ +public final class RestorableDatabaseAccountsGetByLocationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBRestorableDatabaseAccountGet.json + */ + /** + * Sample code: CosmosDBRestorableDatabaseAccountGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBRestorableDatabaseAccountGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getRestorableDatabaseAccounts() + .getByLocationWithResponse("West US", "d9b26648-2f53-4541-b3d8-3044f4f9810d", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableDatabaseAccountsListByLocationSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableDatabaseAccountsListByLocationSamples.java new file mode 100644 index 0000000000000..3c653b110c956 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableDatabaseAccountsListByLocationSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableDatabaseAccounts ListByLocation. */ +public final class RestorableDatabaseAccountsListByLocationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBRestorableDatabaseAccountList.json + */ + /** + * Sample code: CosmosDBRestorableDatabaseAccountList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBRestorableDatabaseAccountList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getRestorableDatabaseAccounts() + .listByLocation("West US", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableDatabaseAccountsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableDatabaseAccountsListSamples.java new file mode 100644 index 0000000000000..b027cc2917932 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableDatabaseAccountsListSamples.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.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableDatabaseAccounts List. */ +public final class RestorableDatabaseAccountsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBRestorableDatabaseAccountNoLocationList.json + */ + /** + * Sample code: CosmosDBRestorableDatabaseAccountNoLocationList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBRestorableDatabaseAccountNoLocationList( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.cosmosDBAccounts().manager().serviceClient().getRestorableDatabaseAccounts().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableMongodbCollectionsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableMongodbCollectionsListSamples.java new file mode 100644 index 0000000000000..4b3dce5a0fc5c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableMongodbCollectionsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableMongodbCollections List. */ +public final class RestorableMongodbCollectionsListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBRestorableMongodbCollectionList.json + */ + /** + * Sample code: CosmosDBRestorableMongodbCollectionList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBRestorableMongodbCollectionList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getRestorableMongodbCollections() + .list("WestUS", "98a570f2-63db-4117-91f0-366327b7b353", "PD5DALigDgw=", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableMongodbDatabasesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableMongodbDatabasesListSamples.java new file mode 100644 index 0000000000000..35eeae191b17f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableMongodbDatabasesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableMongodbDatabases List. */ +public final class RestorableMongodbDatabasesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBRestorableMongodbDatabaseList.json + */ + /** + * Sample code: CosmosDBRestorableMongodbDatabaseList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBRestorableMongodbDatabaseList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getRestorableMongodbDatabases() + .list("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableMongodbResourcesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableMongodbResourcesListSamples.java new file mode 100644 index 0000000000000..265ab47c76489 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableMongodbResourcesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableMongodbResources List. */ +public final class RestorableMongodbResourcesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBRestorableMongodbResourceList.json + */ + /** + * Sample code: CosmosDBRestorableMongodbResourceList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBRestorableMongodbResourceList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getRestorableMongodbResources() + .list("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", "WestUS", "10/13/2020 4:56", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableSqlContainersListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableSqlContainersListSamples.java new file mode 100644 index 0000000000000..e37a9e0cb3221 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableSqlContainersListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableSqlContainers List. */ +public final class RestorableSqlContainersListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBRestorableSqlContainerList.json + */ + /** + * Sample code: CosmosDBRestorableSqlContainerList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBRestorableSqlContainerList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getRestorableSqlContainers() + .list("WestUS", "98a570f2-63db-4117-91f0-366327b7b353", "3fu-hg==", null, null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableSqlDatabasesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableSqlDatabasesListSamples.java new file mode 100644 index 0000000000000..9e9ef45ebbe46 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableSqlDatabasesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableSqlDatabases List. */ +public final class RestorableSqlDatabasesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBRestorableSqlDatabaseList.json + */ + /** + * Sample code: CosmosDBRestorableSqlDatabaseList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBRestorableSqlDatabaseList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getRestorableSqlDatabases() + .list("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableSqlResourcesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableSqlResourcesListSamples.java new file mode 100644 index 0000000000000..1d89b0a4e41db --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/RestorableSqlResourcesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableSqlResources List. */ +public final class RestorableSqlResourcesListSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBRestorableSqlResourceList.json + */ + /** + * Sample code: CosmosDBRestorableSqlResourceList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBRestorableSqlResourceList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getRestorableSqlResources() + .list("WestUS", "d9b26648-2f53-4541-b3d8-3044f4f9810d", "WestUS", "10/13/2020 4:56", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesCreateUpdateSqlContainerSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesCreateUpdateSqlContainerSamples.java new file mode 100644 index 0000000000000..21a084663f0d4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesCreateUpdateSqlContainerSamples.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.ConflictResolutionMode; +import com.azure.resourcemanager.cosmos.models.ConflictResolutionPolicy; +import com.azure.resourcemanager.cosmos.models.ContainerPartitionKey; +import com.azure.resourcemanager.cosmos.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.models.DataType; +import com.azure.resourcemanager.cosmos.models.IncludedPath; +import com.azure.resourcemanager.cosmos.models.IndexKind; +import com.azure.resourcemanager.cosmos.models.Indexes; +import com.azure.resourcemanager.cosmos.models.IndexingMode; +import com.azure.resourcemanager.cosmos.models.IndexingPolicy; +import com.azure.resourcemanager.cosmos.models.PartitionKind; +import com.azure.resourcemanager.cosmos.models.SqlContainerCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.models.SqlContainerResource; +import com.azure.resourcemanager.cosmos.models.UniqueKey; +import com.azure.resourcemanager.cosmos.models.UniqueKeyPolicy; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlResources CreateUpdateSqlContainer. */ +public final class SqlResourcesCreateUpdateSqlContainerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlContainerCreateUpdate.json + */ + /** + * Sample code: CosmosDBSqlContainerCreateUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlContainerCreateUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .createUpdateSqlContainer( + "rg1", + "ddb1", + "databaseName", + "containerName", + new SqlContainerCreateUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource( + new SqlContainerResource() + .withId("containerName") + .withIndexingPolicy( + new IndexingPolicy() + .withAutomatic(true) + .withIndexingMode(IndexingMode.CONSISTENT) + .withIncludedPaths( + Arrays + .asList( + new IncludedPath() + .withPath("/*") + .withIndexes( + Arrays + .asList( + new Indexes() + .withDataType(DataType.STRING) + .withPrecision(-1) + .withKind(IndexKind.RANGE), + new Indexes() + .withDataType(DataType.NUMBER) + .withPrecision(-1) + .withKind(IndexKind.RANGE))))) + .withExcludedPaths(Arrays.asList())) + .withPartitionKey( + new ContainerPartitionKey() + .withPaths(Arrays.asList("/AccountNumber")) + .withKind(PartitionKind.HASH)) + .withDefaultTtl(100) + .withUniqueKeyPolicy( + new UniqueKeyPolicy() + .withUniqueKeys( + Arrays.asList(new UniqueKey().withPaths(Arrays.asList("/testPath"))))) + .withConflictResolutionPolicy( + new ConflictResolutionPolicy() + .withMode(ConflictResolutionMode.LAST_WRITER_WINS) + .withConflictResolutionPath("/path"))) + .withOptions(new CreateUpdateOptions()), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesCreateUpdateSqlDatabaseSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesCreateUpdateSqlDatabaseSamples.java new file mode 100644 index 0000000000000..78cb7befb90a4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesCreateUpdateSqlDatabaseSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.models.SqlDatabaseCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.models.SqlDatabaseResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlResources CreateUpdateSqlDatabase. */ +public final class SqlResourcesCreateUpdateSqlDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlDatabaseCreateUpdate.json + */ + /** + * Sample code: CosmosDBSqlDatabaseCreateUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlDatabaseCreateUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .createUpdateSqlDatabase( + "rg1", + "ddb1", + "databaseName", + new SqlDatabaseCreateUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new SqlDatabaseResource().withId("databaseName")) + .withOptions(new CreateUpdateOptions()), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesCreateUpdateSqlRoleAssignmentSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesCreateUpdateSqlRoleAssignmentSamples.java new file mode 100644 index 0000000000000..5d05e7604c0d9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesCreateUpdateSqlRoleAssignmentSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.SqlRoleAssignmentCreateUpdateParameters; + +/** Samples for SqlResources CreateUpdateSqlRoleAssignment. */ +public final class SqlResourcesCreateUpdateSqlRoleAssignmentSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlRoleAssignmentCreateUpdate.json + */ + /** + * Sample code: CosmosDBSqlRoleAssignmentCreateUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlRoleAssignmentCreateUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .createUpdateSqlRoleAssignment( + "myRoleAssignmentId", + "myResourceGroupName", + "myAccountName", + new SqlRoleAssignmentCreateUpdateParameters() + .withRoleDefinitionId( + "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId") + .withScope( + "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases/colls/redmond-purchases") + .withPrincipalId("myPrincipalId"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesCreateUpdateSqlRoleDefinitionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesCreateUpdateSqlRoleDefinitionSamples.java new file mode 100644 index 0000000000000..d4cb5442bd354 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesCreateUpdateSqlRoleDefinitionSamples.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.Permission; +import com.azure.resourcemanager.cosmos.models.RoleDefinitionType; +import com.azure.resourcemanager.cosmos.models.SqlRoleDefinitionCreateUpdateParameters; +import java.util.Arrays; + +/** Samples for SqlResources CreateUpdateSqlRoleDefinition. */ +public final class SqlResourcesCreateUpdateSqlRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlRoleDefinitionCreateUpdate.json + */ + /** + * Sample code: CosmosDBSqlRoleDefinitionCreateUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlRoleDefinitionCreateUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .createUpdateSqlRoleDefinition( + "myRoleDefinitionId", + "myResourceGroupName", + "myAccountName", + new SqlRoleDefinitionCreateUpdateParameters() + .withRoleName("myRoleName") + .withType(RoleDefinitionType.CUSTOM_ROLE) + .withAssignableScopes( + Arrays + .asList( + "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/sales", + "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases")) + .withPermissions( + Arrays + .asList( + new Permission() + .withDataActions( + Arrays + .asList( + "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/create", + "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read")) + .withNotDataActions(Arrays.asList()))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesCreateUpdateSqlStoredProcedureSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesCreateUpdateSqlStoredProcedureSamples.java new file mode 100644 index 0000000000000..8a3033c823e41 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesCreateUpdateSqlStoredProcedureSamples.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.models.SqlStoredProcedureCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.models.SqlStoredProcedureResource; + +/** Samples for SqlResources CreateUpdateSqlStoredProcedure. */ +public final class SqlResourcesCreateUpdateSqlStoredProcedureSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlStoredProcedureCreateUpdate.json + */ + /** + * Sample code: CosmosDBSqlStoredProcedureCreateUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlStoredProcedureCreateUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .createUpdateSqlStoredProcedure( + "rg1", + "ddb1", + "databaseName", + "containerName", + "storedProcedureName", + new SqlStoredProcedureCreateUpdateParameters() + .withResource(new SqlStoredProcedureResource().withId("storedProcedureName").withBody("body")) + .withOptions(new CreateUpdateOptions()), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesCreateUpdateSqlTriggerSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesCreateUpdateSqlTriggerSamples.java new file mode 100644 index 0000000000000..dbbd88598dcbd --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesCreateUpdateSqlTriggerSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.models.SqlTriggerCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.models.SqlTriggerResource; +import com.azure.resourcemanager.cosmos.models.TriggerOperation; +import com.azure.resourcemanager.cosmos.models.TriggerType; + +/** Samples for SqlResources CreateUpdateSqlTrigger. */ +public final class SqlResourcesCreateUpdateSqlTriggerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlTriggerCreateUpdate.json + */ + /** + * Sample code: CosmosDBSqlTriggerCreateUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlTriggerCreateUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .createUpdateSqlTrigger( + "rg1", + "ddb1", + "databaseName", + "containerName", + "triggerName", + new SqlTriggerCreateUpdateParameters() + .withResource( + new SqlTriggerResource() + .withId("triggerName") + .withBody("body") + .withTriggerType(TriggerType.fromString("triggerType")) + .withTriggerOperation(TriggerOperation.fromString("triggerOperation"))) + .withOptions(new CreateUpdateOptions()), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesCreateUpdateSqlUserDefinedFunctionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesCreateUpdateSqlUserDefinedFunctionSamples.java new file mode 100644 index 0000000000000..316bb917a4a3d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesCreateUpdateSqlUserDefinedFunctionSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.models.SqlUserDefinedFunctionCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.models.SqlUserDefinedFunctionResource; + +/** Samples for SqlResources CreateUpdateSqlUserDefinedFunction. */ +public final class SqlResourcesCreateUpdateSqlUserDefinedFunctionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlUserDefinedFunctionCreateUpdate.json + */ + /** + * Sample code: CosmosDBSqlUserDefinedFunctionCreateUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlUserDefinedFunctionCreateUpdate( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .createUpdateSqlUserDefinedFunction( + "rg1", + "ddb1", + "databaseName", + "containerName", + "userDefinedFunctionName", + new SqlUserDefinedFunctionCreateUpdateParameters() + .withResource( + new SqlUserDefinedFunctionResource().withId("userDefinedFunctionName").withBody("body")) + .withOptions(new CreateUpdateOptions()), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesDeleteSqlContainerSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesDeleteSqlContainerSamples.java new file mode 100644 index 0000000000000..0897a8968f102 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesDeleteSqlContainerSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources DeleteSqlContainer. */ +public final class SqlResourcesDeleteSqlContainerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlContainerDelete.json + */ + /** + * Sample code: CosmosDBSqlContainerDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlContainerDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .deleteSqlContainer("rg1", "ddb1", "databaseName", "containerName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesDeleteSqlDatabaseSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesDeleteSqlDatabaseSamples.java new file mode 100644 index 0000000000000..6f1802927dccf --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesDeleteSqlDatabaseSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources DeleteSqlDatabase. */ +public final class SqlResourcesDeleteSqlDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlDatabaseDelete.json + */ + /** + * Sample code: CosmosDBSqlDatabaseDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlDatabaseDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .deleteSqlDatabase("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesDeleteSqlRoleAssignmentSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesDeleteSqlRoleAssignmentSamples.java new file mode 100644 index 0000000000000..3a5ab24b1f592 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesDeleteSqlRoleAssignmentSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources DeleteSqlRoleAssignment. */ +public final class SqlResourcesDeleteSqlRoleAssignmentSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlRoleAssignmentDelete.json + */ + /** + * Sample code: CosmosDBSqlRoleAssignmentDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlRoleAssignmentDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .deleteSqlRoleAssignment("myRoleAssignmentId", "myResourceGroupName", "myAccountName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesDeleteSqlRoleDefinitionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesDeleteSqlRoleDefinitionSamples.java new file mode 100644 index 0000000000000..a1910f4a5816a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesDeleteSqlRoleDefinitionSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources DeleteSqlRoleDefinition. */ +public final class SqlResourcesDeleteSqlRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlRoleDefinitionDelete.json + */ + /** + * Sample code: CosmosDBSqlRoleDefinitionDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlRoleDefinitionDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .deleteSqlRoleDefinition("myRoleDefinitionId", "myResourceGroupName", "myAccountName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesDeleteSqlStoredProcedureSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesDeleteSqlStoredProcedureSamples.java new file mode 100644 index 0000000000000..3f80d43d4f068 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesDeleteSqlStoredProcedureSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources DeleteSqlStoredProcedure. */ +public final class SqlResourcesDeleteSqlStoredProcedureSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlStoredProcedureDelete.json + */ + /** + * Sample code: CosmosDBSqlStoredProcedureDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlStoredProcedureDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .deleteSqlStoredProcedure( + "rg1", "ddb1", "databaseName", "containerName", "storedProcedureName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesDeleteSqlTriggerSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesDeleteSqlTriggerSamples.java new file mode 100644 index 0000000000000..95eecb26a65a4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesDeleteSqlTriggerSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources DeleteSqlTrigger. */ +public final class SqlResourcesDeleteSqlTriggerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlTriggerDelete.json + */ + /** + * Sample code: CosmosDBSqlTriggerDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlTriggerDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .deleteSqlTrigger("rg1", "ddb1", "databaseName", "containerName", "triggerName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesDeleteSqlUserDefinedFunctionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesDeleteSqlUserDefinedFunctionSamples.java new file mode 100644 index 0000000000000..f268247fdb0bb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesDeleteSqlUserDefinedFunctionSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources DeleteSqlUserDefinedFunction. */ +public final class SqlResourcesDeleteSqlUserDefinedFunctionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlUserDefinedFunctionDelete.json + */ + /** + * Sample code: CosmosDBSqlUserDefinedFunctionDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlUserDefinedFunctionDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .deleteSqlUserDefinedFunction( + "rg1", "ddb1", "databaseName", "containerName", "userDefinedFunctionName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlContainerSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlContainerSamples.java new file mode 100644 index 0000000000000..34e870192e98f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlContainerSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlContainer. */ +public final class SqlResourcesGetSqlContainerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlContainerGet.json + */ + /** + * Sample code: CosmosDBSqlContainerGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlContainerGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .getSqlContainerWithResponse("rgName", "ddb1", "databaseName", "containerName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlContainerThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlContainerThroughputSamples.java new file mode 100644 index 0000000000000..e858701e9b3eb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlContainerThroughputSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlContainerThroughput. */ +public final class SqlResourcesGetSqlContainerThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlContainerThroughputGet.json + */ + /** + * Sample code: CosmosDBSqlContainerThroughputGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlContainerThroughputGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .getSqlContainerThroughputWithResponse("rg1", "ddb1", "databaseName", "containerName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlDatabaseSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlDatabaseSamples.java new file mode 100644 index 0000000000000..ab3d9877ae786 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlDatabaseSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlDatabase. */ +public final class SqlResourcesGetSqlDatabaseSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlDatabaseGet.json + */ + /** + * Sample code: CosmosDBSqlDatabaseGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlDatabaseGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .getSqlDatabaseWithResponse("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlDatabaseThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlDatabaseThroughputSamples.java new file mode 100644 index 0000000000000..d436005cb78d5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlDatabaseThroughputSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlDatabaseThroughput. */ +public final class SqlResourcesGetSqlDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlDatabaseThroughputGet.json + */ + /** + * Sample code: CosmosDBSqlDatabaseThroughputGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlDatabaseThroughputGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .getSqlDatabaseThroughputWithResponse("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlRoleAssignmentSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlRoleAssignmentSamples.java new file mode 100644 index 0000000000000..dc0a5b79f13b7 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlRoleAssignmentSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlRoleAssignment. */ +public final class SqlResourcesGetSqlRoleAssignmentSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlRoleAssignmentGet.json + */ + /** + * Sample code: CosmosDBSqlRoleAssignmentGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlRoleAssignmentGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .getSqlRoleAssignmentWithResponse( + "myRoleAssignmentId", "myResourceGroupName", "myAccountName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlRoleDefinitionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlRoleDefinitionSamples.java new file mode 100644 index 0000000000000..775cad09cefd1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlRoleDefinitionSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlRoleDefinition. */ +public final class SqlResourcesGetSqlRoleDefinitionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlRoleDefinitionGet.json + */ + /** + * Sample code: CosmosDBSqlRoleDefinitionGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlRoleDefinitionGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .getSqlRoleDefinitionWithResponse( + "myRoleDefinitionId", "myResourceGroupName", "myAccountName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlStoredProcedureSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlStoredProcedureSamples.java new file mode 100644 index 0000000000000..7b27745cd94ea --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlStoredProcedureSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlStoredProcedure. */ +public final class SqlResourcesGetSqlStoredProcedureSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlStoredProcedureGet.json + */ + /** + * Sample code: CosmosDBSqlStoredProcedureGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlStoredProcedureGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .getSqlStoredProcedureWithResponse( + "rgName", "ddb1", "databaseName", "containerName", "storedProcedureName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlTriggerSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlTriggerSamples.java new file mode 100644 index 0000000000000..2faef22116650 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlTriggerSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlTrigger. */ +public final class SqlResourcesGetSqlTriggerSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlTriggerGet.json + */ + /** + * Sample code: CosmosDBSqlTriggerGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlTriggerGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .getSqlTriggerWithResponse("rgName", "ddb1", "databaseName", "containerName", "triggerName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlUserDefinedFunctionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlUserDefinedFunctionSamples.java new file mode 100644 index 0000000000000..93e63733e0402 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesGetSqlUserDefinedFunctionSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources GetSqlUserDefinedFunction. */ +public final class SqlResourcesGetSqlUserDefinedFunctionSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlUserDefinedFunctionGet.json + */ + /** + * Sample code: CosmosDBSqlUserDefinedFunctionGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlUserDefinedFunctionGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .getSqlUserDefinedFunctionWithResponse( + "rgName", "ddb1", "databaseName", "containerName", "userDefinedFunctionName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesListSqlContainersSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesListSqlContainersSamples.java new file mode 100644 index 0000000000000..b25dd5a17cc20 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesListSqlContainersSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources ListSqlContainers. */ +public final class SqlResourcesListSqlContainersSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlContainerList.json + */ + /** + * Sample code: CosmosDBSqlContainerList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlContainerList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .listSqlContainers("rgName", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesListSqlDatabasesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesListSqlDatabasesSamples.java new file mode 100644 index 0000000000000..657962d7af010 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesListSqlDatabasesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources ListSqlDatabases. */ +public final class SqlResourcesListSqlDatabasesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlDatabaseList.json + */ + /** + * Sample code: CosmosDBSqlDatabaseList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlDatabaseList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .listSqlDatabases("rgName", "ddb1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesListSqlRoleAssignmentsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesListSqlRoleAssignmentsSamples.java new file mode 100644 index 0000000000000..2e96ac27676c4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesListSqlRoleAssignmentsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources ListSqlRoleAssignments. */ +public final class SqlResourcesListSqlRoleAssignmentsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlRoleAssignmentList.json + */ + /** + * Sample code: CosmosDBSqlRoleAssignmentList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlRoleAssignmentList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .listSqlRoleAssignments("myResourceGroupName", "myAccountName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesListSqlRoleDefinitionsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesListSqlRoleDefinitionsSamples.java new file mode 100644 index 0000000000000..9bbfc11bbee38 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesListSqlRoleDefinitionsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources ListSqlRoleDefinitions. */ +public final class SqlResourcesListSqlRoleDefinitionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlRoleDefinitionList.json + */ + /** + * Sample code: CosmosDBSqlRoleDefinitionList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlRoleDefinitionList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .listSqlRoleDefinitions("myResourceGroupName", "myAccountName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesListSqlStoredProceduresSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesListSqlStoredProceduresSamples.java new file mode 100644 index 0000000000000..651ff0149b838 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesListSqlStoredProceduresSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources ListSqlStoredProcedures. */ +public final class SqlResourcesListSqlStoredProceduresSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlStoredProcedureList.json + */ + /** + * Sample code: CosmosDBSqlStoredProcedureList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlStoredProcedureList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .listSqlStoredProcedures("rgName", "ddb1", "databaseName", "containerName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesListSqlTriggersSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesListSqlTriggersSamples.java new file mode 100644 index 0000000000000..39e8387a4534c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesListSqlTriggersSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources ListSqlTriggers. */ +public final class SqlResourcesListSqlTriggersSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlTriggerList.json + */ + /** + * Sample code: CosmosDBSqlTriggerList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlTriggerList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .listSqlTriggers("rgName", "ddb1", "databaseName", "containerName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesListSqlUserDefinedFunctionsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesListSqlUserDefinedFunctionsSamples.java new file mode 100644 index 0000000000000..6da3ab3257836 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesListSqlUserDefinedFunctionsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources ListSqlUserDefinedFunctions. */ +public final class SqlResourcesListSqlUserDefinedFunctionsSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlUserDefinedFunctionList.json + */ + /** + * Sample code: CosmosDBSqlUserDefinedFunctionList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlUserDefinedFunctionList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .listSqlUserDefinedFunctions("rgName", "ddb1", "databaseName", "containerName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesMigrateSqlContainerToAutoscaleSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesMigrateSqlContainerToAutoscaleSamples.java new file mode 100644 index 0000000000000..9b9ac5af345b5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesMigrateSqlContainerToAutoscaleSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources MigrateSqlContainerToAutoscale. */ +public final class SqlResourcesMigrateSqlContainerToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlContainerMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBSqlContainerMigrateToAutoscale. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlContainerMigrateToAutoscale(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .migrateSqlContainerToAutoscale("rg1", "ddb1", "databaseName", "containerName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesMigrateSqlContainerToManualThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesMigrateSqlContainerToManualThroughputSamples.java new file mode 100644 index 0000000000000..0028579213b65 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesMigrateSqlContainerToManualThroughputSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources MigrateSqlContainerToManualThroughput. */ +public final class SqlResourcesMigrateSqlContainerToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlContainerMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBSqlContainerMigrateToManualThroughput. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlContainerMigrateToManualThroughput( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .migrateSqlContainerToManualThroughput("rg1", "ddb1", "databaseName", "containerName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesMigrateSqlDatabaseToAutoscaleSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesMigrateSqlDatabaseToAutoscaleSamples.java new file mode 100644 index 0000000000000..d7c616c23d6af --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesMigrateSqlDatabaseToAutoscaleSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources MigrateSqlDatabaseToAutoscale. */ +public final class SqlResourcesMigrateSqlDatabaseToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlDatabaseMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBSqlDatabaseMigrateToAutoscale. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlDatabaseMigrateToAutoscale(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .migrateSqlDatabaseToAutoscale("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesMigrateSqlDatabaseToManualThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesMigrateSqlDatabaseToManualThroughputSamples.java new file mode 100644 index 0000000000000..59270c0eb9679 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesMigrateSqlDatabaseToManualThroughputSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlResources MigrateSqlDatabaseToManualThroughput. */ +public final class SqlResourcesMigrateSqlDatabaseToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlDatabaseMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBSqlDatabaseMigrateToManualThroughput. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlDatabaseMigrateToManualThroughput( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .migrateSqlDatabaseToManualThroughput("rg1", "ddb1", "databaseName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesRetrieveContinuousBackupInformationSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesRetrieveContinuousBackupInformationSamples.java new file mode 100644 index 0000000000000..503eba222c364 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesRetrieveContinuousBackupInformationSamples.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.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.ContinuousBackupRestoreLocation; + +/** Samples for SqlResources RetrieveContinuousBackupInformation. */ +public final class SqlResourcesRetrieveContinuousBackupInformationSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlContainerBackupInformation.json + */ + /** + * Sample code: CosmosDBSqlContainerBackupInformation. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlContainerBackupInformation(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .retrieveContinuousBackupInformation( + "rgName", + "ddb1", + "databaseName", + "containerName", + new ContinuousBackupRestoreLocation().withLocation("North Europe"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesUpdateSqlContainerThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesUpdateSqlContainerThroughputSamples.java new file mode 100644 index 0000000000000..bd9ad53961637 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesUpdateSqlContainerThroughputSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlResources UpdateSqlContainerThroughput. */ +public final class SqlResourcesUpdateSqlContainerThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlContainerThroughputUpdate.json + */ + /** + * Sample code: CosmosDBSqlContainerThroughputUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlContainerThroughputUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .updateSqlContainerThroughput( + "rg1", + "ddb1", + "databaseName", + "containerName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesUpdateSqlDatabaseThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesUpdateSqlDatabaseThroughputSamples.java new file mode 100644 index 0000000000000..aef98fbed9ac8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/SqlResourcesUpdateSqlDatabaseThroughputSamples.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.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlResources UpdateSqlDatabaseThroughput. */ +public final class SqlResourcesUpdateSqlDatabaseThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBSqlDatabaseThroughputUpdate.json + */ + /** + * Sample code: CosmosDBSqlDatabaseThroughputUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBSqlDatabaseThroughputUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getSqlResources() + .updateSqlDatabaseThroughput( + "rg1", + "ddb1", + "databaseName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesCreateUpdateTableSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesCreateUpdateTableSamples.java new file mode 100644 index 0000000000000..a44933dda2cde --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesCreateUpdateTableSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.CreateUpdateOptions; +import com.azure.resourcemanager.cosmos.models.TableCreateUpdateParameters; +import com.azure.resourcemanager.cosmos.models.TableResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for TableResources CreateUpdateTable. */ +public final class TableResourcesCreateUpdateTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBTableCreateUpdate.json + */ + /** + * Sample code: CosmosDBTableReplace. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBTableReplace(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getTableResources() + .createUpdateTable( + "rg1", + "ddb1", + "tableName", + new TableCreateUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new TableResource().withId("tableName")) + .withOptions(new CreateUpdateOptions()), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesDeleteTableSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesDeleteTableSamples.java new file mode 100644 index 0000000000000..e9172a11199c6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesDeleteTableSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for TableResources DeleteTable. */ +public final class TableResourcesDeleteTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBTableDelete.json + */ + /** + * Sample code: CosmosDBTableDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBTableDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getTableResources() + .deleteTable("rg1", "ddb1", "tableName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesGetTableSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesGetTableSamples.java new file mode 100644 index 0000000000000..9b8648869623c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesGetTableSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for TableResources GetTable. */ +public final class TableResourcesGetTableSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBTableGet.json + */ + /** + * Sample code: CosmosDBTableGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBTableGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getTableResources() + .getTableWithResponse("rg1", "ddb1", "tableName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesGetTableThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesGetTableThroughputSamples.java new file mode 100644 index 0000000000000..c82a922ddfcf8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesGetTableThroughputSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for TableResources GetTableThroughput. */ +public final class TableResourcesGetTableThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBTableThroughputGet.json + */ + /** + * Sample code: CosmosDBTableThroughputGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBTableThroughputGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getTableResources() + .getTableThroughputWithResponse("rg1", "ddb1", "tableName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesListTablesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesListTablesSamples.java new file mode 100644 index 0000000000000..9dcf2bb49e22b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesListTablesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for TableResources ListTables. */ +public final class TableResourcesListTablesSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBTableList.json + */ + /** + * Sample code: CosmosDBTableList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBTableList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getTableResources() + .listTables("rgName", "ddb1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesMigrateTableToAutoscaleSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesMigrateTableToAutoscaleSamples.java new file mode 100644 index 0000000000000..c0bf13240bac1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesMigrateTableToAutoscaleSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for TableResources MigrateTableToAutoscale. */ +public final class TableResourcesMigrateTableToAutoscaleSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBTableMigrateToAutoscale.json + */ + /** + * Sample code: CosmosDBTableMigrateToAutoscale. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBTableMigrateToAutoscale(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getTableResources() + .migrateTableToAutoscale("rg1", "ddb1", "tableName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesMigrateTableToManualThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesMigrateTableToManualThroughputSamples.java new file mode 100644 index 0000000000000..445a786694ca0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesMigrateTableToManualThroughputSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.cosmos.generated; + +import com.azure.core.util.Context; + +/** Samples for TableResources MigrateTableToManualThroughput. */ +public final class TableResourcesMigrateTableToManualThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBTableMigrateToManualThroughput.json + */ + /** + * Sample code: CosmosDBTableMigrateToManualThroughput. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBTableMigrateToManualThroughput(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getTableResources() + .migrateTableToManualThroughput("rg1", "ddb1", "tableName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesUpdateTableThroughputSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesUpdateTableThroughputSamples.java new file mode 100644 index 0000000000000..e6945074160b3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/cosmos/generated/TableResourcesUpdateTableThroughputSamples.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.cosmos.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.cosmos.models.ThroughputSettingsResource; +import com.azure.resourcemanager.cosmos.models.ThroughputSettingsUpdateParameters; +import java.util.HashMap; +import java.util.Map; + +/** Samples for TableResources UpdateTableThroughput. */ +public final class TableResourcesUpdateTableThroughputSamples { + /* + * x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2021-10-15/examples/CosmosDBTableThroughputUpdate.json + */ + /** + * Sample code: CosmosDBTableThroughputUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void cosmosDBTableThroughputUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .cosmosDBAccounts() + .manager() + .serviceClient() + .getTableResources() + .updateTableThroughput( + "rg1", + "ddb1", + "tableName", + new ThroughputSettingsUpdateParameters() + .withLocation("West US") + .withTags(mapOf()) + .withResource(new ThroughputSettingsResource().withThroughput(400)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..03a5e784dc8e3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersCreateOrUpdateSamples.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.eventhubs.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.eventhubs.fluent.models.ClusterInner; +import com.azure.resourcemanager.eventhubs.models.ClusterSku; +import com.azure.resourcemanager.eventhubs.models.ClusterSkuName; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Clusters CreateOrUpdate. */ +public final class ClustersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/Clusters/ClusterPut.json + */ + /** + * Sample code: ClusterPut. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void clusterPut(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getClusters() + .createOrUpdate( + "myResourceGroup", + "testCluster", + new ClusterInner() + .withLocation("South Central US") + .withTags(mapOf("tag1", "value1", "tag2", "value2")) + .withSku(new ClusterSku().withName(ClusterSkuName.DEDICATED).withCapacity(1)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersDeleteSamples.java new file mode 100644 index 0000000000000..7b2bc33df9931 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for Clusters Delete. */ +public final class ClustersDeleteSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/Clusters/ClusterDelete.json + */ + /** + * Sample code: ClusterDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void clusterDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getClusters() + .delete("myResourceGroup", "testCluster", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..b85291b251844 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for Clusters GetByResourceGroup. */ +public final class ClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/Clusters/ClusterGet.json + */ + /** + * Sample code: ClusterGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void clusterGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getClusters() + .getByResourceGroupWithResponse("myResourceGroup", "testCluster", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersListAvailableClusterRegionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersListAvailableClusterRegionSamples.java new file mode 100644 index 0000000000000..18318e357a676 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersListAvailableClusterRegionSamples.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.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for Clusters ListAvailableClusterRegion. */ +public final class ClustersListAvailableClusterRegionSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/Clusters/ListAvailableClustersGet.json + */ + /** + * Sample code: ListAvailableClusters. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAvailableClusters(com.azure.resourcemanager.AzureResourceManager azure) { + azure.eventHubs().manager().serviceClient().getClusters().listAvailableClusterRegionWithResponse(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersListByResourceGroupSamples.java new file mode 100644 index 0000000000000..aaee4f7b7eae1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersListByResourceGroupSamples.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.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for Clusters ListByResourceGroup. */ +public final class ClustersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/Clusters/ClustersListByResourceGroup.json + */ + /** + * Sample code: ClustersListByResourceGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void clustersListByResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.eventHubs().manager().serviceClient().getClusters().listByResourceGroup("myResourceGroup", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersListNamespacesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersListNamespacesSamples.java new file mode 100644 index 0000000000000..8d93a2d89b00e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersListNamespacesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for Clusters ListNamespaces. */ +public final class ClustersListNamespacesSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/Clusters/ListNamespacesInClusterGet.json + */ + /** + * Sample code: ListNamespacesInCluster. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listNamespacesInCluster(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getClusters() + .listNamespacesWithResponse("myResourceGroup", "testCluster", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersListSamples.java new file mode 100644 index 0000000000000..e3f4f7cc4ec51 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for Clusters List. */ +public final class ClustersListSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/Clusters/ClustersListBySubscription.json + */ + /** + * Sample code: ClustersListBySubscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void clustersListBySubscription(com.azure.resourcemanager.AzureResourceManager azure) { + azure.eventHubs().manager().serviceClient().getClusters().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersUpdateSamples.java new file mode 100644 index 0000000000000..9f74d0727838a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ClustersUpdateSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.eventhubs.fluent.models.ClusterInner; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Clusters Update. */ +public final class ClustersUpdateSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/Clusters/ClusterPatch.json + */ + /** + * Sample code: ClusterPatch. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void clusterPatch(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getClusters() + .update( + "myResourceGroup", + "testCluster", + new ClusterInner().withLocation("South Central US").withTags(mapOf("tag3", "value3", "tag4", "value4")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ConfigurationGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ConfigurationGetSamples.java new file mode 100644 index 0000000000000..c659bc9cf7596 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ConfigurationGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for Configuration Get. */ +public final class ConfigurationGetSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/Clusters/ClusterQuotaConfigurationGet.json + */ + /** + * Sample code: ClustersQuotasConfigurationGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void clustersQuotasConfigurationGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getConfigurations() + .getWithResponse("myResourceGroup", "testCluster", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ConfigurationPatchSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ConfigurationPatchSamples.java new file mode 100644 index 0000000000000..f335678627a1b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ConfigurationPatchSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.eventhubs.fluent.models.ClusterQuotaConfigurationPropertiesInner; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Configuration Patch. */ +public final class ConfigurationPatchSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/Clusters/ClusterQuotaConfigurationPatch.json + */ + /** + * Sample code: ClustersQuotasConfigurationPatch. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void clustersQuotasConfigurationPatch(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getConfigurations() + .patchWithResponse( + "ArunMonocle", + "testCluster", + new ClusterQuotaConfigurationPropertiesInner() + .withSettings(mapOf("eventhub-per-namespace-quota", "20", "namespaces-per-cluster-quota", "200")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ConsumerGroupsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ConsumerGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..1d9a0a9309525 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ConsumerGroupsCreateOrUpdateSamples.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.eventhubs.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.eventhubs.fluent.models.ConsumerGroupInner; + +/** Samples for ConsumerGroups CreateOrUpdate. */ +public final class ConsumerGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/ConsumerGroup/EHConsumerGroupCreate.json + */ + /** + * Sample code: ConsumerGroupCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void consumerGroupCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getConsumerGroups() + .createOrUpdateWithResponse( + "ArunMonocle", + "sdk-Namespace-2661", + "sdk-EventHub-6681", + "sdk-ConsumerGroup-5563", + new ConsumerGroupInner().withUserMetadata("New consumergroup"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ConsumerGroupsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ConsumerGroupsDeleteSamples.java new file mode 100644 index 0000000000000..ca514ea334d14 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ConsumerGroupsDeleteSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for ConsumerGroups Delete. */ +public final class ConsumerGroupsDeleteSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/ConsumerGroup/EHConsumerGroupDelete.json + */ + /** + * Sample code: ConsumerGroupDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void consumerGroupDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getConsumerGroups() + .deleteWithResponse( + "ArunMonocle", "sdk-Namespace-2661", "sdk-EventHub-6681", "sdk-ConsumerGroup-5563", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ConsumerGroupsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ConsumerGroupsGetSamples.java new file mode 100644 index 0000000000000..876be9aff82d7 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ConsumerGroupsGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for ConsumerGroups Get. */ +public final class ConsumerGroupsGetSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/ConsumerGroup/EHConsumerGroupGet.json + */ + /** + * Sample code: ConsumerGroupGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void consumerGroupGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getConsumerGroups() + .getWithResponse( + "ArunMonocle", "sdk-Namespace-2661", "sdk-EventHub-6681", "sdk-ConsumerGroup-5563", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ConsumerGroupsListByEventHubSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ConsumerGroupsListByEventHubSamples.java new file mode 100644 index 0000000000000..8f410d0dfc2f2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/ConsumerGroupsListByEventHubSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for ConsumerGroups ListByEventHub. */ +public final class ConsumerGroupsListByEventHubSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/ConsumerGroup/EHConsumerGroupListByEventHub.json + */ + /** + * Sample code: ConsumerGroupsListAll. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void consumerGroupsListAll(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getConsumerGroups() + .listByEventHub("ArunMonocle", "sdk-Namespace-2661", "sdk-EventHub-6681", null, null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsBreakPairingSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsBreakPairingSamples.java new file mode 100644 index 0000000000000..02b093473b38a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsBreakPairingSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for DisasterRecoveryConfigs BreakPairing. */ +public final class DisasterRecoveryConfigsBreakPairingSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/disasterRecoveryConfigs/EHAliasBreakPairing.json + */ + /** + * Sample code: EHAliasBreakPairing. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void eHAliasBreakPairing(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getDisasterRecoveryConfigs() + .breakPairingWithResponse( + "exampleResourceGroup", "sdk-Namespace-8859", "sdk-DisasterRecovery-3814", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsCheckNameAvailabilitySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsCheckNameAvailabilitySamples.java new file mode 100644 index 0000000000000..0be2abc6dcff0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsCheckNameAvailabilitySamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.eventhubs.models.CheckNameAvailabilityParameter; + +/** Samples for DisasterRecoveryConfigs CheckNameAvailability. */ +public final class DisasterRecoveryConfigsCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/disasterRecoveryConfigs/EHAliasCheckNameAvailability.json + */ + /** + * Sample code: NamespacesCheckNameAvailability. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void namespacesCheckNameAvailability(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getDisasterRecoveryConfigs() + .checkNameAvailabilityWithResponse( + "exampleResourceGroup", + "sdk-Namespace-9080", + new CheckNameAvailabilityParameter().withName("sdk-DisasterRecovery-9474"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..67b48f49f117b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsCreateOrUpdateSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.eventhubs.fluent.models.ArmDisasterRecoveryInner; + +/** Samples for DisasterRecoveryConfigs CreateOrUpdate. */ +public final class DisasterRecoveryConfigsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/disasterRecoveryConfigs/EHAliasCreate.json + */ + /** + * Sample code: EHAliasCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void eHAliasCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getDisasterRecoveryConfigs() + .createOrUpdateWithResponse( + "exampleResourceGroup", + "sdk-Namespace-8859", + "sdk-DisasterRecovery-3814", + new ArmDisasterRecoveryInner().withPartnerNamespace("sdk-Namespace-37"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsDeleteSamples.java new file mode 100644 index 0000000000000..cb216cdc0f463 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsDeleteSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for DisasterRecoveryConfigs Delete. */ +public final class DisasterRecoveryConfigsDeleteSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/disasterRecoveryConfigs/EHAliasDelete.json + */ + /** + * Sample code: EHAliasDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void eHAliasDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getDisasterRecoveryConfigs() + .deleteWithResponse( + "exampleResourceGroup", "sdk-Namespace-5849", "sdk-DisasterRecovery-3814", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsFailOverSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsFailOverSamples.java new file mode 100644 index 0000000000000..e976d07d09339 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsFailOverSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for DisasterRecoveryConfigs FailOver. */ +public final class DisasterRecoveryConfigsFailOverSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/disasterRecoveryConfigs/EHAliasFailOver.json + */ + /** + * Sample code: EHAliasFailOver. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void eHAliasFailOver(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getDisasterRecoveryConfigs() + .failOverWithResponse( + "exampleResourceGroup", "sdk-Namespace-8859", "sdk-DisasterRecovery-3814", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsGetAuthorizationRuleSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsGetAuthorizationRuleSamples.java new file mode 100644 index 0000000000000..181033a0a25f7 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsGetAuthorizationRuleSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for DisasterRecoveryConfigs GetAuthorizationRule. */ +public final class DisasterRecoveryConfigsGetAuthorizationRuleSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/disasterRecoveryConfigs/EHAliasAuthorizationRuleGet.json + */ + /** + * Sample code: NameSpaceAuthorizationRuleGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void nameSpaceAuthorizationRuleGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getDisasterRecoveryConfigs() + .getAuthorizationRuleWithResponse( + "exampleResourceGroup", + "sdk-Namespace-9080", + "sdk-DisasterRecovery-4879", + "sdk-Authrules-4879", + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsGetSamples.java new file mode 100644 index 0000000000000..e59c12b246894 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for DisasterRecoveryConfigs Get. */ +public final class DisasterRecoveryConfigsGetSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/disasterRecoveryConfigs/EHAliasGet.json + */ + /** + * Sample code: EHAliasGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void eHAliasGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getDisasterRecoveryConfigs() + .getWithResponse("exampleResourceGroup", "sdk-Namespace-8859", "sdk-DisasterRecovery-3814", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsListAuthorizationRulesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsListAuthorizationRulesSamples.java new file mode 100644 index 0000000000000..29e9b57e62932 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsListAuthorizationRulesSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for DisasterRecoveryConfigs ListAuthorizationRules. */ +public final class DisasterRecoveryConfigsListAuthorizationRulesSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/disasterRecoveryConfigs/EHAliasAuthorizationRuleListAll.json + */ + /** + * Sample code: ListAuthorizationRules. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAuthorizationRules(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getDisasterRecoveryConfigs() + .listAuthorizationRules( + "exampleResourceGroup", "sdk-Namespace-9080", "sdk-DisasterRecovery-4047", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsListKeysSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsListKeysSamples.java new file mode 100644 index 0000000000000..7ea887de757e6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsListKeysSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for DisasterRecoveryConfigs ListKeys. */ +public final class DisasterRecoveryConfigsListKeysSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/disasterRecoveryConfigs/EHAliasAuthorizationRuleListKey.json + */ + /** + * Sample code: NameSpaceAuthorizationRuleListKey. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void nameSpaceAuthorizationRuleListKey(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getDisasterRecoveryConfigs() + .listKeysWithResponse( + "exampleResourceGroup", + "sdk-Namespace-2702", + "sdk-DisasterRecovery-4047", + "sdk-Authrules-1746", + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsListSamples.java new file mode 100644 index 0000000000000..0bc4618e7417a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/DisasterRecoveryConfigsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for DisasterRecoveryConfigs List. */ +public final class DisasterRecoveryConfigsListSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/disasterRecoveryConfigs/EHAliasList.json + */ + /** + * Sample code: EHAliasList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void eHAliasList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getDisasterRecoveryConfigs() + .list("exampleResourceGroup", "sdk-Namespace-8859", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsCreateOrUpdateAuthorizationRuleSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsCreateOrUpdateAuthorizationRuleSamples.java new file mode 100644 index 0000000000000..17fa5689897d4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsCreateOrUpdateAuthorizationRuleSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.eventhubs.fluent.models.AuthorizationRuleInner; +import com.azure.resourcemanager.eventhubs.models.AccessRights; +import java.util.Arrays; + +/** Samples for EventHubs CreateOrUpdateAuthorizationRule. */ +public final class EventHubsCreateOrUpdateAuthorizationRuleSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/EventHubs/EHEventHubAuthorizationRuleCreate.json + */ + /** + * Sample code: EventHubAuthorizationRuleCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void eventHubAuthorizationRuleCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getEventHubs() + .createOrUpdateAuthorizationRuleWithResponse( + "ArunMonocle", + "sdk-Namespace-960", + "sdk-EventHub-532", + "sdk-Authrules-2513", + new AuthorizationRuleInner().withRights(Arrays.asList(AccessRights.LISTEN, AccessRights.SEND)), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..589308811ee0e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsCreateOrUpdateSamples.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.eventhubs.fluent.models.EventhubInner; +import com.azure.resourcemanager.eventhubs.models.CaptureDescription; +import com.azure.resourcemanager.eventhubs.models.Destination; +import com.azure.resourcemanager.eventhubs.models.EncodingCaptureDescription; +import com.azure.resourcemanager.eventhubs.models.EntityStatus; + +/** Samples for EventHubs CreateOrUpdate. */ +public final class EventHubsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/EventHubs/EHEventHubCreate.json + */ + /** + * Sample code: EventHubCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void eventHubCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getEventHubs() + .createOrUpdateWithResponse( + "Default-NotificationHubs-AustraliaEast", + "sdk-Namespace-5357", + "sdk-EventHub-6547", + new EventhubInner() + .withMessageRetentionInDays(4L) + .withPartitionCount(4L) + .withStatus(EntityStatus.ACTIVE) + .withCaptureDescription( + new CaptureDescription() + .withEnabled(true) + .withEncoding(EncodingCaptureDescription.AVRO) + .withIntervalInSeconds(120) + .withSizeLimitInBytes(10485763) + .withDestination( + new Destination() + .withName("EventHubArchive.AzureBlockBlob") + .withStorageAccountResourceId( + "/subscriptions/e2f361f0-3b27-4503-a9cc-21cfba380093/resourceGroups/Default-Storage-SouthCentralUS/providers/Microsoft.ClassicStorage/storageAccounts/arjunteststorage") + .withBlobContainer("container") + .withArchiveNameFormat( + "{Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}"))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsDeleteAuthorizationRuleSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsDeleteAuthorizationRuleSamples.java new file mode 100644 index 0000000000000..4a9e6a2a72f1a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsDeleteAuthorizationRuleSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for EventHubs DeleteAuthorizationRule. */ +public final class EventHubsDeleteAuthorizationRuleSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/EventHubs/EHEventHubAuthorizationRuleDelete.json + */ + /** + * Sample code: EventHubAuthorizationRuleDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void eventHubAuthorizationRuleDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getEventHubs() + .deleteAuthorizationRuleWithResponse( + "ArunMonocle", "sdk-Namespace-960", "sdk-EventHub-532", "sdk-Authrules-2513", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsDeleteSamples.java new file mode 100644 index 0000000000000..445fa6c658ae0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for EventHubs Delete. */ +public final class EventHubsDeleteSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/EventHubs/EHEventHubDelete.json + */ + /** + * Sample code: EventHubDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void eventHubDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getEventHubs() + .deleteWithResponse("ArunMonocle", "sdk-Namespace-5357", "sdk-EventHub-6547", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsGetAuthorizationRuleSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsGetAuthorizationRuleSamples.java new file mode 100644 index 0000000000000..d567f40dc5290 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsGetAuthorizationRuleSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for EventHubs GetAuthorizationRule. */ +public final class EventHubsGetAuthorizationRuleSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/EventHubs/EHEventHubAuthorizationRuleGet.json + */ + /** + * Sample code: EventHubAuthorizationRuleGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void eventHubAuthorizationRuleGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getEventHubs() + .getAuthorizationRuleWithResponse( + "ArunMonocle", "sdk-Namespace-960", "sdk-EventHub-532", "sdk-Authrules-2513", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsGetSamples.java new file mode 100644 index 0000000000000..c3369e897b7fe --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for EventHubs Get. */ +public final class EventHubsGetSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/EventHubs/EHEventHubGet.json + */ + /** + * Sample code: EventHubGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void eventHubGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getEventHubs() + .getWithResponse( + "Default-NotificationHubs-AustraliaEast", "sdk-Namespace-716", "sdk-EventHub-10", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsListAuthorizationRulesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsListAuthorizationRulesSamples.java new file mode 100644 index 0000000000000..8c9cea7f1f327 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsListAuthorizationRulesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for EventHubs ListAuthorizationRules. */ +public final class EventHubsListAuthorizationRulesSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/EventHubs/EHEventHubAuthorizationRuleListAll.json + */ + /** + * Sample code: EventHubAuthorizationRuleListAll. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void eventHubAuthorizationRuleListAll(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getEventHubs() + .listAuthorizationRules("ArunMonocle", "sdk-Namespace-960", "sdk-EventHub-532", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsListByNamespaceSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsListByNamespaceSamples.java new file mode 100644 index 0000000000000..4a7b6cf36935b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsListByNamespaceSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for EventHubs ListByNamespace. */ +public final class EventHubsListByNamespaceSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/EventHubs/EHEventHubListByNameSpace.json + */ + /** + * Sample code: EventHubsListAll. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void eventHubsListAll(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getEventHubs() + .listByNamespace("Default-NotificationHubs-AustraliaEast", "sdk-Namespace-5357", null, null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsListKeysSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsListKeysSamples.java new file mode 100644 index 0000000000000..ea13936794ce7 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsListKeysSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for EventHubs ListKeys. */ +public final class EventHubsListKeysSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/EventHubs/EHEventHubAuthorizationRuleListKey.json + */ + /** + * Sample code: EventHubAuthorizationRuleListKey. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void eventHubAuthorizationRuleListKey(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getEventHubs() + .listKeysWithResponse( + "ArunMonocle", "sdk-namespace-960", "sdk-EventHub-532", "sdk-Authrules-2513", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsRegenerateKeysSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsRegenerateKeysSamples.java new file mode 100644 index 0000000000000..584df40e47808 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/EventHubsRegenerateKeysSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.eventhubs.models.KeyType; +import com.azure.resourcemanager.eventhubs.models.RegenerateAccessKeyParameters; + +/** Samples for EventHubs RegenerateKeys. */ +public final class EventHubsRegenerateKeysSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/EventHubs/EHEventHubAuthorizationRuleRegenerateKey.json + */ + /** + * Sample code: EventHubAuthorizationRuleRegenerateKey. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void eventHubAuthorizationRuleRegenerateKey(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getEventHubs() + .regenerateKeysWithResponse( + "ArunMonocle", + "sdk-namespace-960", + "sdk-EventHub-532", + "sdk-Authrules-1534", + new RegenerateAccessKeyParameters().withKeyType(KeyType.PRIMARY_KEY), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesCheckNameAvailabilitySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesCheckNameAvailabilitySamples.java new file mode 100644 index 0000000000000..9e6a199893099 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesCheckNameAvailabilitySamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.eventhubs.models.CheckNameAvailabilityParameter; + +/** Samples for Namespaces CheckNameAvailability. */ +public final class NamespacesCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/NameSpaces/EHNameSpaceCheckNameAvailability.json + */ + /** + * Sample code: NamespacesCheckNameAvailability. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void namespacesCheckNameAvailability(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getNamespaces() + .checkNameAvailabilityWithResponse( + new CheckNameAvailabilityParameter().withName("sdk-Namespace-8458"), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesCreateOrUpdateAuthorizationRuleSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesCreateOrUpdateAuthorizationRuleSamples.java new file mode 100644 index 0000000000000..64ebc8a582fcf --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesCreateOrUpdateAuthorizationRuleSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.eventhubs.fluent.models.AuthorizationRuleInner; +import com.azure.resourcemanager.eventhubs.models.AccessRights; +import java.util.Arrays; + +/** Samples for Namespaces CreateOrUpdateAuthorizationRule. */ +public final class NamespacesCreateOrUpdateAuthorizationRuleSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/NameSpaces/EHNameSpaceAuthorizationRuleCreate.json + */ + /** + * Sample code: NameSpaceAuthorizationRuleCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void nameSpaceAuthorizationRuleCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getNamespaces() + .createOrUpdateAuthorizationRuleWithResponse( + "ArunMonocle", + "sdk-Namespace-2702", + "sdk-Authrules-1746", + new AuthorizationRuleInner().withRights(Arrays.asList(AccessRights.LISTEN, AccessRights.SEND)), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesCreateOrUpdateNetworkRuleSetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesCreateOrUpdateNetworkRuleSetSamples.java new file mode 100644 index 0000000000000..9a032c0fed4e1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesCreateOrUpdateNetworkRuleSetSamples.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.eventhubs.fluent.models.NetworkRuleSetInner; +import com.azure.resourcemanager.eventhubs.models.DefaultAction; +import com.azure.resourcemanager.eventhubs.models.NWRuleSetIpRules; +import com.azure.resourcemanager.eventhubs.models.NWRuleSetVirtualNetworkRules; +import com.azure.resourcemanager.eventhubs.models.NetworkRuleIpAction; +import com.azure.resourcemanager.eventhubs.models.Subnet; +import java.util.Arrays; + +/** Samples for Namespaces CreateOrUpdateNetworkRuleSet. */ +public final class NamespacesCreateOrUpdateNetworkRuleSetSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/NameSpaces/VirtualNetworkRule/EHNetworkRuleSetCreate.json + */ + /** + * Sample code: NameSpaceNetworkRuleSetCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void nameSpaceNetworkRuleSetCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getNamespaces() + .createOrUpdateNetworkRuleSetWithResponse( + "ResourceGroup", + "sdk-Namespace-6019", + new NetworkRuleSetInner() + .withDefaultAction(DefaultAction.DENY) + .withVirtualNetworkRules( + Arrays + .asList( + new NWRuleSetVirtualNetworkRules() + .withSubnet( + new Subnet() + .withId( + "/subscriptions/subscriptionid/resourcegroups/resourcegroupid/providers/Microsoft.Network/virtualNetworks/myvn/subnets/subnet2")) + .withIgnoreMissingVnetServiceEndpoint(true), + new NWRuleSetVirtualNetworkRules() + .withSubnet( + new Subnet() + .withId( + "/subscriptions/subscriptionid/resourcegroups/resourcegroupid/providers/Microsoft.Network/virtualNetworks/myvn/subnets/subnet3")) + .withIgnoreMissingVnetServiceEndpoint(false), + new NWRuleSetVirtualNetworkRules() + .withSubnet( + new Subnet() + .withId( + "/subscriptions/subscriptionid/resourcegroups/resourcegroupid/providers/Microsoft.Network/virtualNetworks/myvn/subnets/subnet6")) + .withIgnoreMissingVnetServiceEndpoint(false))) + .withIpRules( + Arrays + .asList( + new NWRuleSetIpRules().withIpMask("1.1.1.1").withAction(NetworkRuleIpAction.ALLOW), + new NWRuleSetIpRules().withIpMask("1.1.1.2").withAction(NetworkRuleIpAction.ALLOW), + new NWRuleSetIpRules().withIpMask("1.1.1.3").withAction(NetworkRuleIpAction.ALLOW), + new NWRuleSetIpRules().withIpMask("1.1.1.4").withAction(NetworkRuleIpAction.ALLOW), + new NWRuleSetIpRules().withIpMask("1.1.1.5").withAction(NetworkRuleIpAction.ALLOW))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..716b74d5a7fe0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesCreateOrUpdateSamples.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.eventhubs.fluent.models.EHNamespaceInner; +import com.azure.resourcemanager.eventhubs.models.Encryption; +import com.azure.resourcemanager.eventhubs.models.Identity; +import com.azure.resourcemanager.eventhubs.models.KeySource; +import com.azure.resourcemanager.eventhubs.models.KeyVaultProperties; +import com.azure.resourcemanager.eventhubs.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.eventhubs.models.UserAssignedIdentity; +import com.azure.resourcemanager.eventhubs.models.UserAssignedIdentityProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Namespaces CreateOrUpdate. */ +public final class NamespacesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/NameSpaces/EHNameSpaceCreate.json + */ + /** + * Sample code: NamespaceCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void namespaceCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getNamespaces() + .createOrUpdate( + "ResurceGroupSample", + "NamespaceSample", + new EHNamespaceInner() + .withLocation("East US") + .withIdentity( + new Identity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud1", + new UserAssignedIdentity(), + "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud2", + new UserAssignedIdentity()))) + .withClusterArmId( + "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.EventHub/clusters/enc-test") + .withEncryption( + new Encryption() + .withKeyVaultProperties( + Arrays + .asList( + new KeyVaultProperties() + .withKeyName("Samplekey") + .withKeyVaultUri("https://aprao-keyvault-user.vault-int.azure-int.net/") + .withIdentity( + new UserAssignedIdentityProperties() + .withUserAssignedIdentity( + "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud1")))) + .withKeySource(KeySource.MICROSOFT_KEY_VAULT)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesDeleteAuthorizationRuleSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesDeleteAuthorizationRuleSamples.java new file mode 100644 index 0000000000000..a37fe10d53aa8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesDeleteAuthorizationRuleSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for Namespaces DeleteAuthorizationRule. */ +public final class NamespacesDeleteAuthorizationRuleSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/NameSpaces/EHNameSpaceAuthorizationRuleDelete.json + */ + /** + * Sample code: NameSpaceAuthorizationRuleDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void nameSpaceAuthorizationRuleDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getNamespaces() + .deleteAuthorizationRuleWithResponse( + "ArunMonocle", "sdk-Namespace-8980", "sdk-Authrules-8929", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesDeleteSamples.java new file mode 100644 index 0000000000000..0f8826af7f0ea --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for Namespaces Delete. */ +public final class NamespacesDeleteSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/NameSpaces/EHNameSpaceDelete.json + */ + /** + * Sample code: NameSpaceDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void nameSpaceDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getNamespaces() + .delete("ResurceGroupSample", "NamespaceSample", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesGetAuthorizationRuleSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesGetAuthorizationRuleSamples.java new file mode 100644 index 0000000000000..9796972f95032 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesGetAuthorizationRuleSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for Namespaces GetAuthorizationRule. */ +public final class NamespacesGetAuthorizationRuleSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/NameSpaces/EHNameSpaceAuthorizationRuleGet.json + */ + /** + * Sample code: NameSpaceAuthorizationRuleGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void nameSpaceAuthorizationRuleGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getNamespaces() + .getAuthorizationRuleWithResponse("ArunMonocle", "sdk-Namespace-2702", "sdk-Authrules-1746", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..b7ca693c8e8af --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for Namespaces GetByResourceGroup. */ +public final class NamespacesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/NameSpaces/EHNameSpaceGet.json + */ + /** + * Sample code: NameSpaceGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void nameSpaceGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getNamespaces() + .getByResourceGroupWithResponse("ResurceGroupSample", "NamespaceSample", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesGetNetworkRuleSetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesGetNetworkRuleSetSamples.java new file mode 100644 index 0000000000000..93e8735b99893 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesGetNetworkRuleSetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for Namespaces GetNetworkRuleSet. */ +public final class NamespacesGetNetworkRuleSetSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/NameSpaces/VirtualNetworkRule/EHNetworkRuleSetGet.json + */ + /** + * Sample code: NameSpaceNetworkRuleSetGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void nameSpaceNetworkRuleSetGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getNamespaces() + .getNetworkRuleSetWithResponse("ResourceGroup", "sdk-Namespace-6019", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesListAuthorizationRulesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesListAuthorizationRulesSamples.java new file mode 100644 index 0000000000000..d3a0d3c537b34 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesListAuthorizationRulesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for Namespaces ListAuthorizationRules. */ +public final class NamespacesListAuthorizationRulesSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/NameSpaces/EHNameSpaceAuthorizationRuleListAll.json + */ + /** + * Sample code: ListAuthorizationRules. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAuthorizationRules(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getNamespaces() + .listAuthorizationRules("ArunMonocle", "sdk-Namespace-2702", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..f55d8728b578d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesListByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for Namespaces ListByResourceGroup. */ +public final class NamespacesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/NameSpaces/EHNameSpaceListByResourceGroup.json + */ + /** + * Sample code: NamespaceListByResourceGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void namespaceListByResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getNamespaces() + .listByResourceGroup("ResurceGroupSample", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesListKeysSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesListKeysSamples.java new file mode 100644 index 0000000000000..c1a39646752dd --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesListKeysSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for Namespaces ListKeys. */ +public final class NamespacesListKeysSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/NameSpaces/EHNameSpaceAuthorizationRuleListKey.json + */ + /** + * Sample code: NameSpaceAuthorizationRuleListKey. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void nameSpaceAuthorizationRuleListKey(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getNamespaces() + .listKeysWithResponse("ArunMonocle", "sdk-Namespace-2702", "sdk-Authrules-1746", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesListNetworkRuleSetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesListNetworkRuleSetSamples.java new file mode 100644 index 0000000000000..25a788ff48c55 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesListNetworkRuleSetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for Namespaces ListNetworkRuleSet. */ +public final class NamespacesListNetworkRuleSetSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/NameSpaces/VirtualNetworkRule/EHNetworkRuleSetList.json + */ + /** + * Sample code: NameSpaceNetworkRuleSetList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void nameSpaceNetworkRuleSetList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getNamespaces() + .listNetworkRuleSetWithResponse("ResourceGroup", "sdk-Namespace-6019", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesListSamples.java new file mode 100644 index 0000000000000..31c3b91f4c8b3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesListSamples.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.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for Namespaces List. */ +public final class NamespacesListSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/NameSpaces/EHNameSpaceList.json + */ + /** + * Sample code: NamespacesListBySubscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void namespacesListBySubscription(com.azure.resourcemanager.AzureResourceManager azure) { + azure.eventHubs().manager().serviceClient().getNamespaces().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesRegenerateKeysSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesRegenerateKeysSamples.java new file mode 100644 index 0000000000000..c26148843bb8a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesRegenerateKeysSamples.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.eventhubs.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.eventhubs.models.KeyType; +import com.azure.resourcemanager.eventhubs.models.RegenerateAccessKeyParameters; + +/** Samples for Namespaces RegenerateKeys. */ +public final class NamespacesRegenerateKeysSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/NameSpaces/EHNameSpaceAuthorizationRuleRegenerateKey.json + */ + /** + * Sample code: NameSpaceAuthorizationRuleRegenerateKey. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void nameSpaceAuthorizationRuleRegenerateKey(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getNamespaces() + .regenerateKeysWithResponse( + "ArunMonocle", + "sdk-Namespace-8980", + "sdk-Authrules-8929", + new RegenerateAccessKeyParameters().withKeyType(KeyType.PRIMARY_KEY), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesUpdateSamples.java new file mode 100644 index 0000000000000..5ac79a5e5aa3d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/NamespacesUpdateSamples.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.eventhubs.fluent.models.EHNamespaceInner; +import com.azure.resourcemanager.eventhubs.models.Identity; +import com.azure.resourcemanager.eventhubs.models.ManagedServiceIdentityType; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Namespaces Update. */ +public final class NamespacesUpdateSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/NameSpaces/EHNameSpaceUpdate.json + */ + /** + * Sample code: NamespacesUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void namespacesUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getNamespaces() + .updateWithResponse( + "ResurceGroupSample", + "NamespaceSample", + new EHNamespaceInner() + .withLocation("East US") + .withIdentity( + new Identity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud2", + null))), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/OperationsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..da230a2037ff9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/EHOperations_List.json + */ + /** + * Sample code: EHOperations_List. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void eHOperationsList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.eventHubs().manager().serviceClient().getOperations().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..5697aeb732a82 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.eventhubs.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.eventhubs.models.ConnectionState; +import com.azure.resourcemanager.eventhubs.models.EndPointProvisioningState; +import com.azure.resourcemanager.eventhubs.models.PrivateEndpoint; +import com.azure.resourcemanager.eventhubs.models.PrivateLinkConnectionStatus; + +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/NameSpaces/PrivateEndPointConnectionCreate.json + */ + /** + * Sample code: NameSpacePrivateEndPointConnectionCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void nameSpacePrivateEndPointConnectionCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdateWithResponse( + "ArunMonocle", + "sdk-Namespace-2924", + "privateEndpointConnectionName", + new PrivateEndpointConnectionInner() + .withPrivateEndpoint( + new PrivateEndpoint() + .withId( + "/subscriptions/dbedb4e0-40e6-4145-81f3-f1314c150774/resourceGroups/SDK-EventHub-8396/providers/Microsoft.Network/privateEndpoints/sdk-Namespace-2847")) + .withPrivateLinkServiceConnectionState( + new ConnectionState() + .withStatus(PrivateLinkConnectionStatus.REJECTED) + .withDescription("testing")) + .withProvisioningState(EndPointProvisioningState.SUCCEEDED), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/PrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..9f1fc0b4b6d02 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/PrivateEndpointConnectionsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/NameSpaces/PrivateEndPointConnectionDelete.json + */ + /** + * Sample code: NameSpacePrivateEndPointConnectionDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void nameSpacePrivateEndPointConnectionDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getPrivateEndpointConnections() + .delete("ArunMonocle", "sdk-Namespace-3285", "928c44d5-b7c6-423b-b6fa-811e0c27b3e0", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/PrivateEndpointConnectionsGetSamples.java new file mode 100644 index 0000000000000..6b51fb049179d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/PrivateEndpointConnectionsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/NameSpaces/PrivateEndPointConnectionGet.json + */ + /** + * Sample code: NameSpacePrivateEndPointConnectionGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void nameSpacePrivateEndPointConnectionGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse("SDK-EventHub-4794", "sdk-Namespace-5828", "privateEndpointConnectionName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/PrivateEndpointConnectionsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/PrivateEndpointConnectionsListSamples.java new file mode 100644 index 0000000000000..9518ba31cf82b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/PrivateEndpointConnectionsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections List. */ +public final class PrivateEndpointConnectionsListSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/NameSpaces/PrivateEndPointConnectionList.json + */ + /** + * Sample code: NameSpaceCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void nameSpaceCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getPrivateEndpointConnections() + .list("SDK-EventHub-4794", "sdk-Namespace-5828", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/PrivateLinkResourcesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/PrivateLinkResourcesGetSamples.java new file mode 100644 index 0000000000000..827b919ccb2b9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/PrivateLinkResourcesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources Get. */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/NameSpaces/PrivateLinkResourcesGet.json + */ + /** + * Sample code: NameSpacePrivateLinkResourcesGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void nameSpacePrivateLinkResourcesGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getPrivateLinkResources() + .getWithResponse("ArunMonocle", "sdk-Namespace-2924", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/SchemaRegistryCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/SchemaRegistryCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..fd67e41fd1775 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/SchemaRegistryCreateOrUpdateSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.eventhubs.fluent.models.SchemaGroupInner; +import com.azure.resourcemanager.eventhubs.models.SchemaCompatibility; +import com.azure.resourcemanager.eventhubs.models.SchemaType; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SchemaRegistry CreateOrUpdate. */ +public final class SchemaRegistryCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/SchemaRegistry/SchemaRegistryCreate.json + */ + /** + * Sample code: SchemaRegistryCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void schemaRegistryCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getSchemaRegistries() + .createOrUpdateWithResponse( + "alitest", + "ali-ua-test-eh-system-1", + "testSchemaGroup1", + new SchemaGroupInner() + .withGroupProperties(mapOf()) + .withSchemaCompatibility(SchemaCompatibility.FORWARD) + .withSchemaType(SchemaType.AVRO), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/SchemaRegistryDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/SchemaRegistryDeleteSamples.java new file mode 100644 index 0000000000000..4dca6421b157e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/SchemaRegistryDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for SchemaRegistry Delete. */ +public final class SchemaRegistryDeleteSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/SchemaRegistry/SchemaRegistryDelete.json + */ + /** + * Sample code: SchemaRegistryDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void schemaRegistryDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getSchemaRegistries() + .deleteWithResponse("alitest", "ali-ua-test-eh-system-1", "testSchemaGroup1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/SchemaRegistryGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/SchemaRegistryGetSamples.java new file mode 100644 index 0000000000000..76932176d0492 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/SchemaRegistryGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for SchemaRegistry Get. */ +public final class SchemaRegistryGetSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/SchemaRegistry/SchemaRegistryGet.json + */ + /** + * Sample code: SchemaRegistryGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void schemaRegistryGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getSchemaRegistries() + .getWithResponse("alitest", "ali-ua-test-eh-system-1", "testSchemaGroup1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/SchemaRegistryListByNamespaceSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/SchemaRegistryListByNamespaceSamples.java new file mode 100644 index 0000000000000..817cadf540de9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/eventhubs/generated/SchemaRegistryListByNamespaceSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.eventhubs.generated; + +import com.azure.core.util.Context; + +/** Samples for SchemaRegistry ListByNamespace. */ +public final class SchemaRegistryListByNamespaceSamples { + /* + * x-ms-original-file: specification/eventhub/resource-manager/Microsoft.EventHub/stable/2021-11-01/examples/SchemaRegistry/SchemaRegistryListByNamespace.json + */ + /** + * Sample code: SchemaRegistryListAll. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void schemaRegistryListAll(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .eventHubs() + .manager() + .serviceClient() + .getSchemaRegistries() + .listByNamespace("alitest", "ali-ua-test-eh-system-1", null, null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewayPrivateEndpointConnectionsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewayPrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..e2e401b1851e1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewayPrivateEndpointConnectionsDeleteSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationGatewayPrivateEndpointConnections Delete. */ +public final class ApplicationGatewayPrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayPrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Delete Application Gateway Private Endpoint Connection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteApplicationGatewayPrivateEndpointConnection( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationGatewayPrivateEndpointConnections() + .delete("rg1", "appgw", "connection1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewayPrivateEndpointConnectionsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewayPrivateEndpointConnectionsGetSamples.java new file mode 100644 index 0000000000000..5d299544c218a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewayPrivateEndpointConnectionsGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationGatewayPrivateEndpointConnections Get. */ +public final class ApplicationGatewayPrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayPrivateEndpointConnectionGet.json + */ + /** + * Sample code: Get Application Gateway Private Endpoint Connection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getApplicationGatewayPrivateEndpointConnection( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationGatewayPrivateEndpointConnections() + .getWithResponse("rg1", "appgw", "connection1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewayPrivateEndpointConnectionsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewayPrivateEndpointConnectionsListSamples.java new file mode 100644 index 0000000000000..cd3cf7a83b845 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewayPrivateEndpointConnectionsListSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationGatewayPrivateEndpointConnections List. */ +public final class ApplicationGatewayPrivateEndpointConnectionsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayPrivateEndpointConnectionList.json + */ + /** + * Sample code: Lists all private endpoint connections on application gateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listsAllPrivateEndpointConnectionsOnApplicationGateway( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationGatewayPrivateEndpointConnections() + .list("rg1", "appgw", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewayPrivateEndpointConnectionsUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewayPrivateEndpointConnectionsUpdateSamples.java new file mode 100644 index 0000000000000..7909eae6011c5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewayPrivateEndpointConnectionsUpdateSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.ApplicationGatewayPrivateEndpointConnectionInner; +import com.azure.resourcemanager.network.models.PrivateLinkServiceConnectionState; + +/** Samples for ApplicationGatewayPrivateEndpointConnections Update. */ +public final class ApplicationGatewayPrivateEndpointConnectionsUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayPrivateEndpointConnectionUpdate.json + */ + /** + * Sample code: Update Application Gateway Private Endpoint Connection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateApplicationGatewayPrivateEndpointConnection( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationGatewayPrivateEndpointConnections() + .update( + "rg1", + "appgw", + "connection1", + new ApplicationGatewayPrivateEndpointConnectionInner() + .withName("connection1") + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus("Approved") + .withDescription("approved it for some reason.")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewayPrivateLinkResourcesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewayPrivateLinkResourcesListSamples.java new file mode 100644 index 0000000000000..7f12866c5fe23 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewayPrivateLinkResourcesListSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationGatewayPrivateLinkResources List. */ +public final class ApplicationGatewayPrivateLinkResourcesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayPrivateLinkResourceList.json + */ + /** + * Sample code: Lists all private link resources on application gateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listsAllPrivateLinkResourcesOnApplicationGateway( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationGatewayPrivateLinkResources() + .list("rg1", "appgw", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysBackendHealthOnDemandSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysBackendHealthOnDemandSamples.java new file mode 100644 index 0000000000000..2fa671b321457 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysBackendHealthOnDemandSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.ApplicationGatewayOnDemandProbe; +import com.azure.resourcemanager.network.models.ApplicationGatewayProtocol; + +/** Samples for ApplicationGateways BackendHealthOnDemand. */ +public final class ApplicationGatewaysBackendHealthOnDemandSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayBackendHealthTest.json + */ + /** + * Sample code: Test Backend Health. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void testBackendHealth(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationGateways() + .backendHealthOnDemand( + "rg1", + "appgw", + new ApplicationGatewayOnDemandProbe() + .withProtocol(ApplicationGatewayProtocol.HTTP) + .withPath("/") + .withTimeout(30) + .withPickHostnameFromBackendHttpSettings(true) + .withBackendAddressPool( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendaddressPools/MFAnalyticsPool")) + .withBackendHttpSettings( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/MFPoolSettings")), + null, + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysBackendHealthSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysBackendHealthSamples.java new file mode 100644 index 0000000000000..aebe017eb0988 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysBackendHealthSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationGateways BackendHealth. */ +public final class ApplicationGatewaysBackendHealthSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayBackendHealthGet.json + */ + /** + * Sample code: Get Backend Health. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getBackendHealth(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationGateways() + .backendHealth("appgw", "appgw", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..26f83d8ae3267 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysCreateOrUpdateSamples.java @@ -0,0 +1,376 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.ApplicationGatewayInner; +import com.azure.resourcemanager.network.fluent.models.ApplicationGatewayIpConfigurationInner; +import com.azure.resourcemanager.network.fluent.models.ApplicationGatewayPathRuleInner; +import com.azure.resourcemanager.network.fluent.models.ApplicationGatewayRequestRoutingRuleInner; +import com.azure.resourcemanager.network.fluent.models.ApplicationGatewaySslCertificateInner; +import com.azure.resourcemanager.network.fluent.models.ApplicationGatewayUrlPathMapInner; +import com.azure.resourcemanager.network.models.ApplicationGatewayBackendAddress; +import com.azure.resourcemanager.network.models.ApplicationGatewayBackendAddressPool; +import com.azure.resourcemanager.network.models.ApplicationGatewayBackendHttpSettings; +import com.azure.resourcemanager.network.models.ApplicationGatewayClientAuthConfiguration; +import com.azure.resourcemanager.network.models.ApplicationGatewayCookieBasedAffinity; +import com.azure.resourcemanager.network.models.ApplicationGatewayFrontendIpConfiguration; +import com.azure.resourcemanager.network.models.ApplicationGatewayFrontendPort; +import com.azure.resourcemanager.network.models.ApplicationGatewayGlobalConfiguration; +import com.azure.resourcemanager.network.models.ApplicationGatewayHeaderConfiguration; +import com.azure.resourcemanager.network.models.ApplicationGatewayHttpListener; +import com.azure.resourcemanager.network.models.ApplicationGatewayLoadDistributionAlgorithm; +import com.azure.resourcemanager.network.models.ApplicationGatewayLoadDistributionPolicy; +import com.azure.resourcemanager.network.models.ApplicationGatewayLoadDistributionTarget; +import com.azure.resourcemanager.network.models.ApplicationGatewayProtocol; +import com.azure.resourcemanager.network.models.ApplicationGatewayRequestRoutingRuleType; +import com.azure.resourcemanager.network.models.ApplicationGatewayRewriteRule; +import com.azure.resourcemanager.network.models.ApplicationGatewayRewriteRuleActionSet; +import com.azure.resourcemanager.network.models.ApplicationGatewayRewriteRuleCondition; +import com.azure.resourcemanager.network.models.ApplicationGatewayRewriteRuleSet; +import com.azure.resourcemanager.network.models.ApplicationGatewaySku; +import com.azure.resourcemanager.network.models.ApplicationGatewaySkuName; +import com.azure.resourcemanager.network.models.ApplicationGatewaySslCipherSuite; +import com.azure.resourcemanager.network.models.ApplicationGatewaySslPolicy; +import com.azure.resourcemanager.network.models.ApplicationGatewaySslPolicyType; +import com.azure.resourcemanager.network.models.ApplicationGatewaySslProfile; +import com.azure.resourcemanager.network.models.ApplicationGatewaySslProtocol; +import com.azure.resourcemanager.network.models.ApplicationGatewayTier; +import com.azure.resourcemanager.network.models.ApplicationGatewayTrustedClientCertificate; +import com.azure.resourcemanager.network.models.ApplicationGatewayTrustedRootCertificate; +import com.azure.resourcemanager.network.models.ApplicationGatewayUrlConfiguration; +import com.azure.resourcemanager.network.models.ManagedServiceIdentity; +import com.azure.resourcemanager.network.models.ManagedServiceIdentityUserAssignedIdentities; +import com.azure.resourcemanager.network.models.ResourceIdentityType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ApplicationGateways CreateOrUpdate. */ +public final class ApplicationGatewaysCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayCreate.json + */ + /** + * Sample code: Create Application Gateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createApplicationGateway(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationGateways() + .createOrUpdate( + "rg1", + "appgw", + new ApplicationGatewayInner() + .withLocation("eastus") + .withIdentity( + new ManagedServiceIdentity() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1", + new ManagedServiceIdentityUserAssignedIdentities()))) + .withSku( + new ApplicationGatewaySku() + .withName(ApplicationGatewaySkuName.STANDARD_V2) + .withTier(ApplicationGatewayTier.STANDARD_V2) + .withCapacity(3)) + .withGatewayIpConfigurations( + Arrays + .asList( + new ApplicationGatewayIpConfigurationInner() + .withName("appgwipc") + .withSubnet( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet/subnets/appgwsubnet")))) + .withTrustedRootCertificates( + Arrays + .asList( + new ApplicationGatewayTrustedRootCertificate().withName("rootcert").withData("****"), + new ApplicationGatewayTrustedRootCertificate() + .withName("rootcert1") + .withKeyVaultSecretId("https://kv/secret"))) + .withTrustedClientCertificates( + Arrays + .asList( + new ApplicationGatewayTrustedClientCertificate() + .withName("clientcert") + .withData("****"))) + .withSslCertificates( + Arrays + .asList( + new ApplicationGatewaySslCertificateInner() + .withName("sslcert") + .withData("****") + .withPassword("****"), + new ApplicationGatewaySslCertificateInner() + .withName("sslcert2") + .withKeyVaultSecretId("https://kv/secret"))) + .withFrontendIpConfigurations( + Arrays + .asList( + new ApplicationGatewayFrontendIpConfiguration() + .withName("appgwfip") + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/appgwpip")))) + .withFrontendPorts( + Arrays + .asList( + new ApplicationGatewayFrontendPort().withName("appgwfp").withPort(443), + new ApplicationGatewayFrontendPort().withName("appgwfp80").withPort(80))) + .withBackendAddressPools( + Arrays + .asList( + new ApplicationGatewayBackendAddressPool() + .withName("appgwpool") + .withBackendAddresses( + Arrays + .asList( + new ApplicationGatewayBackendAddress().withIpAddress("10.0.1.1"), + new ApplicationGatewayBackendAddress().withIpAddress("10.0.1.2"))), + new ApplicationGatewayBackendAddressPool() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool1") + .withName("appgwpool1") + .withBackendAddresses( + Arrays + .asList( + new ApplicationGatewayBackendAddress(), + new ApplicationGatewayBackendAddress())))) + .withBackendHttpSettingsCollection( + Arrays + .asList( + new ApplicationGatewayBackendHttpSettings() + .withName("appgwbhs") + .withPort(80) + .withProtocol(ApplicationGatewayProtocol.HTTP) + .withCookieBasedAffinity(ApplicationGatewayCookieBasedAffinity.DISABLED) + .withRequestTimeout(30))) + .withHttpListeners( + Arrays + .asList( + new ApplicationGatewayHttpListener() + .withName("appgwhl") + .withFrontendIpConfiguration( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendIPConfigurations/appgwfip")) + .withFrontendPort( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendPorts/appgwfp")) + .withProtocol(ApplicationGatewayProtocol.HTTPS) + .withSslCertificate( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/sslCertificates/sslcert")) + .withSslProfile( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/sslProfiles/sslProfile1")) + .withRequireServerNameIndication(false), + new ApplicationGatewayHttpListener() + .withName("appgwhttplistener") + .withFrontendIpConfiguration( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendIPConfigurations/appgwfip")) + .withFrontendPort( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/frontendPorts/appgwfp80")) + .withProtocol(ApplicationGatewayProtocol.HTTP))) + .withSslProfiles( + Arrays + .asList( + new ApplicationGatewaySslProfile() + .withName("sslProfile1") + .withTrustedClientCertificates( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/trustedClientCertificates/clientcert"))) + .withSslPolicy( + new ApplicationGatewaySslPolicy() + .withPolicyType(ApplicationGatewaySslPolicyType.CUSTOM) + .withCipherSuites( + Arrays + .asList( + ApplicationGatewaySslCipherSuite + .TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256)) + .withMinProtocolVersion(ApplicationGatewaySslProtocol.TLSV1_1)) + .withClientAuthConfiguration( + new ApplicationGatewayClientAuthConfiguration() + .withVerifyClientCertIssuerDN(true)))) + .withUrlPathMaps( + Arrays + .asList( + new ApplicationGatewayUrlPathMapInner() + .withName("pathMap1") + .withDefaultBackendAddressPool( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool")) + .withDefaultBackendHttpSettings( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/appgwbhs")) + .withDefaultRewriteRuleSet( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/rewriteRuleSets/rewriteRuleSet1")) + .withDefaultLoadDistributionPolicy( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/loadDistributionPolicies/ldp1")) + .withPathRules( + Arrays + .asList( + new ApplicationGatewayPathRuleInner() + .withName("apiPaths") + .withPaths(Arrays.asList("/api", "/v1/api")) + .withBackendAddressPool( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool")) + .withBackendHttpSettings( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/appgwbhs")) + .withRewriteRuleSet( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/rewriteRuleSets/rewriteRuleSet1")) + .withLoadDistributionPolicy( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/loadDistributionPolicies/ldp1")))))) + .withRequestRoutingRules( + Arrays + .asList( + new ApplicationGatewayRequestRoutingRuleInner() + .withName("appgwrule") + .withRuleType(ApplicationGatewayRequestRoutingRuleType.BASIC) + .withPriority(10) + .withBackendAddressPool( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool")) + .withBackendHttpSettings( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendHttpSettingsCollection/appgwbhs")) + .withHttpListener( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/httpListeners/appgwhl")) + .withRewriteRuleSet( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/rewriteRuleSets/rewriteRuleSet1")) + .withLoadDistributionPolicy( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/loadDistributionPolicies/ldp1")), + new ApplicationGatewayRequestRoutingRuleInner() + .withName("appgwPathBasedRule") + .withRuleType(ApplicationGatewayRequestRoutingRuleType.PATH_BASED_ROUTING) + .withPriority(20) + .withHttpListener( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/httpListeners/appgwhttplistener")) + .withUrlPathMap( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/urlPathMaps/pathMap1")))) + .withRewriteRuleSets( + Arrays + .asList( + new ApplicationGatewayRewriteRuleSet() + .withName("rewriteRuleSet1") + .withRewriteRules( + Arrays + .asList( + new ApplicationGatewayRewriteRule() + .withName("Set X-Forwarded-For") + .withRuleSequence(102) + .withConditions( + Arrays + .asList( + new ApplicationGatewayRewriteRuleCondition() + .withVariable("http_req_Authorization") + .withPattern("^Bearer") + .withIgnoreCase(true) + .withNegate(false))) + .withActionSet( + new ApplicationGatewayRewriteRuleActionSet() + .withRequestHeaderConfigurations( + Arrays + .asList( + new ApplicationGatewayHeaderConfiguration() + .withHeaderName("X-Forwarded-For") + .withHeaderValue( + "{var_add_x_forwarded_for_proxy}"))) + .withResponseHeaderConfigurations( + Arrays + .asList( + new ApplicationGatewayHeaderConfiguration() + .withHeaderName("Strict-Transport-Security") + .withHeaderValue("max-age=31536000"))) + .withUrlConfiguration( + new ApplicationGatewayUrlConfiguration() + .withModifiedPath("/abc"))))))) + .withLoadDistributionPolicies( + Arrays + .asList( + new ApplicationGatewayLoadDistributionPolicy() + .withName("ldp1") + .withLoadDistributionTargets( + Arrays + .asList( + new ApplicationGatewayLoadDistributionTarget() + .withName("ld11") + .withWeightPerServer(40) + .withBackendAddressPool( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool")), + new ApplicationGatewayLoadDistributionTarget() + .withName("ld11") + .withWeightPerServer(60) + .withBackendAddressPool( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/applicationGateways/appgw/backendAddressPools/appgwpool1")))) + .withLoadDistributionAlgorithm( + ApplicationGatewayLoadDistributionAlgorithm.ROUND_ROBIN))) + .withGlobalConfiguration( + new ApplicationGatewayGlobalConfiguration() + .withEnableRequestBuffering(true) + .withEnableResponseBuffering(true)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysDeleteSamples.java new file mode 100644 index 0000000000000..ff81d1de339de --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationGateways Delete. */ +public final class ApplicationGatewaysDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayDelete.json + */ + /** + * Sample code: Delete ApplicationGateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteApplicationGateway(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getApplicationGateways().delete("rg1", "appgw", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..73872d538d177 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationGateways GetByResourceGroup. */ +public final class ApplicationGatewaysGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayGet.json + */ + /** + * Sample code: Get ApplicationGateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getApplicationGateway(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationGateways() + .getByResourceGroupWithResponse("rg1", "appgw", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysGetSslPredefinedPolicySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysGetSslPredefinedPolicySamples.java new file mode 100644 index 0000000000000..c3bba287ca6ae --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysGetSslPredefinedPolicySamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationGateways GetSslPredefinedPolicy. */ +public final class ApplicationGatewaysGetSslPredefinedPolicySamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayAvailableSslOptionsPredefinedPolicyGet.json + */ + /** + * Sample code: Get Available Ssl Predefined Policy by name. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAvailableSslPredefinedPolicyByName(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationGateways() + .getSslPredefinedPolicyWithResponse("AppGwSslPolicy20150501", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListAvailableRequestHeadersSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListAvailableRequestHeadersSamples.java new file mode 100644 index 0000000000000..d4a11ea8e2dd9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListAvailableRequestHeadersSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationGateways ListAvailableRequestHeaders. */ +public final class ApplicationGatewaysListAvailableRequestHeadersSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayAvailableRequestHeadersGet.json + */ + /** + * Sample code: Get Available Request Headers. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAvailableRequestHeaders(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationGateways() + .listAvailableRequestHeadersWithResponse(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListAvailableResponseHeadersSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListAvailableResponseHeadersSamples.java new file mode 100644 index 0000000000000..4a32ba31299ec --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListAvailableResponseHeadersSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationGateways ListAvailableResponseHeaders. */ +public final class ApplicationGatewaysListAvailableResponseHeadersSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayAvailableResponseHeadersGet.json + */ + /** + * Sample code: Get Available Response Headers. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAvailableResponseHeaders(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationGateways() + .listAvailableResponseHeadersWithResponse(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListAvailableServerVariablesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListAvailableServerVariablesSamples.java new file mode 100644 index 0000000000000..778ad1ff531b8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListAvailableServerVariablesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationGateways ListAvailableServerVariables. */ +public final class ApplicationGatewaysListAvailableServerVariablesSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayAvailableServerVariablesGet.json + */ + /** + * Sample code: Get Available Server Variables. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAvailableServerVariables(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationGateways() + .listAvailableServerVariablesWithResponse(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListAvailableSslOptionsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListAvailableSslOptionsSamples.java new file mode 100644 index 0000000000000..4d56ec654f9c1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListAvailableSslOptionsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationGateways ListAvailableSslOptions. */ +public final class ApplicationGatewaysListAvailableSslOptionsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayAvailableSslOptionsGet.json + */ + /** + * Sample code: Get Available Ssl Options. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAvailableSslOptions(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationGateways() + .listAvailableSslOptionsWithResponse(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListAvailableSslPredefinedPoliciesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListAvailableSslPredefinedPoliciesSamples.java new file mode 100644 index 0000000000000..10f9eba7cc552 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListAvailableSslPredefinedPoliciesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationGateways ListAvailableSslPredefinedPolicies. */ +public final class ApplicationGatewaysListAvailableSslPredefinedPoliciesSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayAvailableSslOptionsPredefinedPoliciesGet.json + */ + /** + * Sample code: Get Available Ssl Predefined Policies. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAvailableSslPredefinedPolicies(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationGateways() + .listAvailableSslPredefinedPolicies(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListAvailableWafRuleSetsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListAvailableWafRuleSetsSamples.java new file mode 100644 index 0000000000000..b17a716f44486 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListAvailableWafRuleSetsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationGateways ListAvailableWafRuleSets. */ +public final class ApplicationGatewaysListAvailableWafRuleSetsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayAvailableWafRuleSetsGet.json + */ + /** + * Sample code: Get Available Waf Rule Sets. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAvailableWafRuleSets(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationGateways() + .listAvailableWafRuleSetsWithResponse(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListByResourceGroupSamples.java new file mode 100644 index 0000000000000..8ce1a2f2a5051 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationGateways ListByResourceGroup. */ +public final class ApplicationGatewaysListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayList.json + */ + /** + * Sample code: Lists all application gateways in a resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listsAllApplicationGatewaysInAResourceGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getApplicationGateways().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListSamples.java new file mode 100644 index 0000000000000..33bb385be62fc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationGateways List. */ +public final class ApplicationGatewaysListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayListAll.json + */ + /** + * Sample code: Lists all application gateways in a subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listsAllApplicationGatewaysInASubscription( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getApplicationGateways().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysStartSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysStartSamples.java new file mode 100644 index 0000000000000..e88344580e9c4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysStartSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationGateways Start. */ +public final class ApplicationGatewaysStartSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayStart.json + */ + /** + * Sample code: Start Application Gateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void startApplicationGateway(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getApplicationGateways().start("rg1", "appgw", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysStopSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysStopSamples.java new file mode 100644 index 0000000000000..d8317b7b71b22 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysStopSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationGateways Stop. */ +public final class ApplicationGatewaysStopSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayStop.json + */ + /** + * Sample code: Stop Application Gateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void stopApplicationGateway(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getApplicationGateways().stop("rg1", "appgw", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysUpdateTagsSamples.java new file mode 100644 index 0000000000000..f3f83950dae5c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationGatewaysUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ApplicationGateways UpdateTags. */ +public final class ApplicationGatewaysUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationGatewayUpdateTags.json + */ + /** + * Sample code: Update Application Gateway tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateApplicationGatewayTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationGateways() + .updateTagsWithResponse( + "rg1", "AppGw", new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationSecurityGroupsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationSecurityGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..5c6848b9ace2c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationSecurityGroupsCreateOrUpdateSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.ApplicationSecurityGroupInner; + +/** Samples for ApplicationSecurityGroups CreateOrUpdate. */ +public final class ApplicationSecurityGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationSecurityGroupCreate.json + */ + /** + * Sample code: Create application security group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createApplicationSecurityGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationSecurityGroups() + .createOrUpdate( + "rg1", "test-asg", new ApplicationSecurityGroupInner().withLocation("westus"), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationSecurityGroupsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationSecurityGroupsDeleteSamples.java new file mode 100644 index 0000000000000..ff87833e2de55 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationSecurityGroupsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationSecurityGroups Delete. */ +public final class ApplicationSecurityGroupsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationSecurityGroupDelete.json + */ + /** + * Sample code: Delete application security group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteApplicationSecurityGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationSecurityGroups() + .delete("rg1", "test-asg", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationSecurityGroupsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationSecurityGroupsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..c3d7456e84cfc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationSecurityGroupsGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationSecurityGroups GetByResourceGroup. */ +public final class ApplicationSecurityGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationSecurityGroupGet.json + */ + /** + * Sample code: Get application security group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getApplicationSecurityGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationSecurityGroups() + .getByResourceGroupWithResponse("rg1", "test-asg", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationSecurityGroupsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationSecurityGroupsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..27907f2de839e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationSecurityGroupsListByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationSecurityGroups ListByResourceGroup. */ +public final class ApplicationSecurityGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationSecurityGroupList.json + */ + /** + * Sample code: List load balancers in resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listLoadBalancersInResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationSecurityGroups() + .listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationSecurityGroupsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationSecurityGroupsListSamples.java new file mode 100644 index 0000000000000..e0e1f5fd03fd7 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationSecurityGroupsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ApplicationSecurityGroups List. */ +public final class ApplicationSecurityGroupsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationSecurityGroupListAll.json + */ + /** + * Sample code: List all application security groups. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllApplicationSecurityGroups(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getApplicationSecurityGroups().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationSecurityGroupsUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationSecurityGroupsUpdateTagsSamples.java new file mode 100644 index 0000000000000..79b20294f5f00 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ApplicationSecurityGroupsUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ApplicationSecurityGroups UpdateTags. */ +public final class ApplicationSecurityGroupsUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ApplicationSecurityGroupUpdateTags.json + */ + /** + * Sample code: Update application security group tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateApplicationSecurityGroupTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getApplicationSecurityGroups() + .updateTagsWithResponse( + "rg1", "test-asg", new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AvailableDelegationsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AvailableDelegationsListSamples.java new file mode 100644 index 0000000000000..bdc4915a72292 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AvailableDelegationsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for AvailableDelegations List. */ +public final class AvailableDelegationsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AvailableDelegationsSubscriptionGet.json + */ + /** + * Sample code: Get available delegations. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAvailableDelegations(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getAvailableDelegations().list("westcentralus", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AvailableEndpointServicesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AvailableEndpointServicesListSamples.java new file mode 100644 index 0000000000000..bd463d38ce56e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AvailableEndpointServicesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for AvailableEndpointServices List. */ +public final class AvailableEndpointServicesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/EndpointServicesList.json + */ + /** + * Sample code: EndpointServicesList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void endpointServicesList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getAvailableEndpointServices().list("westus", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AvailablePrivateEndpointTypesListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AvailablePrivateEndpointTypesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..321cc02455d19 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AvailablePrivateEndpointTypesListByResourceGroupSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for AvailablePrivateEndpointTypes ListByResourceGroup. */ +public final class AvailablePrivateEndpointTypesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AvailablePrivateEndpointTypesResourceGroupGet.json + */ + /** + * Sample code: Get available PrivateEndpoint types in the resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAvailablePrivateEndpointTypesInTheResourceGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getAvailablePrivateEndpointTypes() + .listByResourceGroup("regionName", "rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AvailablePrivateEndpointTypesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AvailablePrivateEndpointTypesListSamples.java new file mode 100644 index 0000000000000..81bc564b9ed58 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AvailablePrivateEndpointTypesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for AvailablePrivateEndpointTypes List. */ +public final class AvailablePrivateEndpointTypesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AvailablePrivateEndpointTypesGet.json + */ + /** + * Sample code: Get available PrivateEndpoint types. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAvailablePrivateEndpointTypes(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getAvailablePrivateEndpointTypes().list("regionName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AvailableResourceGroupDelegationsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AvailableResourceGroupDelegationsListSamples.java new file mode 100644 index 0000000000000..5085ec0ed3b68 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AvailableResourceGroupDelegationsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for AvailableResourceGroupDelegations List. */ +public final class AvailableResourceGroupDelegationsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AvailableDelegationsResourceGroupGet.json + */ + /** + * Sample code: Get available delegations in the resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAvailableDelegationsInTheResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getAvailableResourceGroupDelegations() + .list("westcentralus", "rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AvailableServiceAliasesListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AvailableServiceAliasesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..13e8331c6045a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AvailableServiceAliasesListByResourceGroupSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for AvailableServiceAliases ListByResourceGroup. */ +public final class AvailableServiceAliasesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AvailableServiceAliasesListByResourceGroup.json + */ + /** + * Sample code: Get available service aliases in the resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAvailableServiceAliasesInTheResourceGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getAvailableServiceAliases() + .listByResourceGroup("rg1", "westcentralus", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AvailableServiceAliasesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AvailableServiceAliasesListSamples.java new file mode 100644 index 0000000000000..ff454c3daf573 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AvailableServiceAliasesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for AvailableServiceAliases List. */ +public final class AvailableServiceAliasesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AvailableServiceAliasesList.json + */ + /** + * Sample code: Get available service aliases. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAvailableServiceAliases(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getAvailableServiceAliases().list("westcentralus", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AzureFirewallFqdnTagsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AzureFirewallFqdnTagsListSamples.java new file mode 100644 index 0000000000000..89aba2cbef5da --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AzureFirewallFqdnTagsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for AzureFirewallFqdnTags List. */ +public final class AzureFirewallFqdnTagsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AzureFirewallFqdnTagsListBySubscription.json + */ + /** + * Sample code: List all Azure Firewall FQDN Tags for a given subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllAzureFirewallFQDNTagsForAGivenSubscription( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getAzureFirewallFqdnTags().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AzureFirewallsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AzureFirewallsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..b4b6c8c21899e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AzureFirewallsCreateOrUpdateSamples.java @@ -0,0 +1,699 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.AzureFirewallInner; +import com.azure.resourcemanager.network.models.AzureFirewallApplicationRule; +import com.azure.resourcemanager.network.models.AzureFirewallApplicationRuleCollection; +import com.azure.resourcemanager.network.models.AzureFirewallApplicationRuleProtocol; +import com.azure.resourcemanager.network.models.AzureFirewallApplicationRuleProtocolType; +import com.azure.resourcemanager.network.models.AzureFirewallIpConfiguration; +import com.azure.resourcemanager.network.models.AzureFirewallNatRCAction; +import com.azure.resourcemanager.network.models.AzureFirewallNatRCActionType; +import com.azure.resourcemanager.network.models.AzureFirewallNatRule; +import com.azure.resourcemanager.network.models.AzureFirewallNatRuleCollection; +import com.azure.resourcemanager.network.models.AzureFirewallNetworkRule; +import com.azure.resourcemanager.network.models.AzureFirewallNetworkRuleCollection; +import com.azure.resourcemanager.network.models.AzureFirewallNetworkRuleProtocol; +import com.azure.resourcemanager.network.models.AzureFirewallRCAction; +import com.azure.resourcemanager.network.models.AzureFirewallRCActionType; +import com.azure.resourcemanager.network.models.AzureFirewallSku; +import com.azure.resourcemanager.network.models.AzureFirewallSkuName; +import com.azure.resourcemanager.network.models.AzureFirewallSkuTier; +import com.azure.resourcemanager.network.models.AzureFirewallThreatIntelMode; +import com.azure.resourcemanager.network.models.HubIpAddresses; +import com.azure.resourcemanager.network.models.HubPublicIpAddresses; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AzureFirewalls CreateOrUpdate. */ +public final class AzureFirewallsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AzureFirewallPutWithIpGroups.json + */ + /** + * Sample code: Create Azure Firewall With IpGroups. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAzureFirewallWithIpGroups(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getAzureFirewalls() + .createOrUpdate( + "rg1", + "azurefirewall", + new AzureFirewallInner() + .withLocation("West US") + .withTags(mapOf("key1", "value1")) + .withZones(Arrays.asList()) + .withApplicationRuleCollections( + Arrays + .asList( + new AzureFirewallApplicationRuleCollection() + .withName("apprulecoll") + .withPriority(110) + .withAction(new AzureFirewallRCAction().withType(AzureFirewallRCActionType.DENY)) + .withRules( + Arrays + .asList( + new AzureFirewallApplicationRule() + .withName("rule1") + .withDescription("Deny inbound rule") + .withSourceAddresses(Arrays.asList("216.58.216.164", "10.0.0.0/24")) + .withProtocols( + Arrays + .asList( + new AzureFirewallApplicationRuleProtocol() + .withProtocolType( + AzureFirewallApplicationRuleProtocolType.HTTPS) + .withPort(443))) + .withTargetFqdns(Arrays.asList("www.test.com")))))) + .withNatRuleCollections( + Arrays + .asList( + new AzureFirewallNatRuleCollection() + .withName("natrulecoll") + .withPriority(112) + .withAction( + new AzureFirewallNatRCAction().withType(AzureFirewallNatRCActionType.DNAT)) + .withRules( + Arrays + .asList( + new AzureFirewallNatRule() + .withName("DNAT-HTTPS-traffic") + .withDescription("D-NAT all outbound web traffic for inspection") + .withSourceAddresses(Arrays.asList("*")) + .withDestinationAddresses(Arrays.asList("1.2.3.4")) + .withDestinationPorts(Arrays.asList("443")) + .withProtocols(Arrays.asList(AzureFirewallNetworkRuleProtocol.TCP)) + .withTranslatedAddress("1.2.3.5") + .withTranslatedPort("8443"), + new AzureFirewallNatRule() + .withName("DNAT-HTTP-traffic-With-FQDN") + .withDescription("D-NAT all inbound web traffic for inspection") + .withSourceAddresses(Arrays.asList("*")) + .withDestinationAddresses(Arrays.asList("1.2.3.4")) + .withDestinationPorts(Arrays.asList("80")) + .withProtocols(Arrays.asList(AzureFirewallNetworkRuleProtocol.TCP)) + .withTranslatedPort("880") + .withTranslatedFqdn("internalhttpserver"))))) + .withNetworkRuleCollections( + Arrays + .asList( + new AzureFirewallNetworkRuleCollection() + .withName("netrulecoll") + .withPriority(112) + .withAction(new AzureFirewallRCAction().withType(AzureFirewallRCActionType.DENY)) + .withRules( + Arrays + .asList( + new AzureFirewallNetworkRule() + .withName("L4-traffic") + .withDescription("Block traffic based on source IPs and ports") + .withProtocols(Arrays.asList(AzureFirewallNetworkRuleProtocol.TCP)) + .withSourceAddresses( + Arrays + .asList("192.168.1.1-192.168.1.12", "10.1.4.12-10.1.4.255")) + .withDestinationAddresses(Arrays.asList("*")) + .withDestinationPorts(Arrays.asList("443-444", "8443")), + new AzureFirewallNetworkRule() + .withName("L4-traffic-with-FQDN") + .withDescription( + "Block traffic based on source IPs and ports to amazon") + .withProtocols(Arrays.asList(AzureFirewallNetworkRuleProtocol.TCP)) + .withSourceAddresses(Arrays.asList("10.2.4.12-10.2.4.255")) + .withDestinationPorts(Arrays.asList("443-444", "8443")) + .withDestinationFqdns(Arrays.asList("www.amazon.com")))))) + .withIpConfigurations( + Arrays + .asList( + new AzureFirewallIpConfiguration() + .withName("azureFirewallIpConfiguration") + .withSubnet( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet")) + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName")))) + .withThreatIntelMode(AzureFirewallThreatIntelMode.ALERT) + .withSku( + new AzureFirewallSku() + .withName(AzureFirewallSkuName.AZFW_VNET) + .withTier(AzureFirewallSkuTier.STANDARD)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AzureFirewallPutWithZones.json + */ + /** + * Sample code: Create Azure Firewall With Zones. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAzureFirewallWithZones(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getAzureFirewalls() + .createOrUpdate( + "rg1", + "azurefirewall", + new AzureFirewallInner() + .withLocation("West US 2") + .withTags(mapOf("key1", "value1")) + .withZones(Arrays.asList("1", "2", "3")) + .withApplicationRuleCollections( + Arrays + .asList( + new AzureFirewallApplicationRuleCollection() + .withName("apprulecoll") + .withPriority(110) + .withAction(new AzureFirewallRCAction().withType(AzureFirewallRCActionType.DENY)) + .withRules( + Arrays + .asList( + new AzureFirewallApplicationRule() + .withName("rule1") + .withDescription("Deny inbound rule") + .withSourceAddresses(Arrays.asList("216.58.216.164", "10.0.0.0/24")) + .withProtocols( + Arrays + .asList( + new AzureFirewallApplicationRuleProtocol() + .withProtocolType( + AzureFirewallApplicationRuleProtocolType.HTTPS) + .withPort(443))) + .withTargetFqdns(Arrays.asList("www.test.com")))))) + .withNatRuleCollections( + Arrays + .asList( + new AzureFirewallNatRuleCollection() + .withName("natrulecoll") + .withPriority(112) + .withAction( + new AzureFirewallNatRCAction().withType(AzureFirewallNatRCActionType.DNAT)) + .withRules( + Arrays + .asList( + new AzureFirewallNatRule() + .withName("DNAT-HTTPS-traffic") + .withDescription("D-NAT all outbound web traffic for inspection") + .withSourceAddresses(Arrays.asList("*")) + .withDestinationAddresses(Arrays.asList("1.2.3.4")) + .withDestinationPorts(Arrays.asList("443")) + .withProtocols(Arrays.asList(AzureFirewallNetworkRuleProtocol.TCP)) + .withTranslatedAddress("1.2.3.5") + .withTranslatedPort("8443"), + new AzureFirewallNatRule() + .withName("DNAT-HTTP-traffic-With-FQDN") + .withDescription("D-NAT all inbound web traffic for inspection") + .withSourceAddresses(Arrays.asList("*")) + .withDestinationAddresses(Arrays.asList("1.2.3.4")) + .withDestinationPorts(Arrays.asList("80")) + .withProtocols(Arrays.asList(AzureFirewallNetworkRuleProtocol.TCP)) + .withTranslatedPort("880") + .withTranslatedFqdn("internalhttpserver"))))) + .withNetworkRuleCollections( + Arrays + .asList( + new AzureFirewallNetworkRuleCollection() + .withName("netrulecoll") + .withPriority(112) + .withAction(new AzureFirewallRCAction().withType(AzureFirewallRCActionType.DENY)) + .withRules( + Arrays + .asList( + new AzureFirewallNetworkRule() + .withName("L4-traffic") + .withDescription("Block traffic based on source IPs and ports") + .withProtocols(Arrays.asList(AzureFirewallNetworkRuleProtocol.TCP)) + .withSourceAddresses( + Arrays + .asList("192.168.1.1-192.168.1.12", "10.1.4.12-10.1.4.255")) + .withDestinationAddresses(Arrays.asList("*")) + .withDestinationPorts(Arrays.asList("443-444", "8443")), + new AzureFirewallNetworkRule() + .withName("L4-traffic-with-FQDN") + .withDescription( + "Block traffic based on source IPs and ports to amazon") + .withProtocols(Arrays.asList(AzureFirewallNetworkRuleProtocol.TCP)) + .withSourceAddresses(Arrays.asList("10.2.4.12-10.2.4.255")) + .withDestinationPorts(Arrays.asList("443-444", "8443")) + .withDestinationFqdns(Arrays.asList("www.amazon.com")))))) + .withIpConfigurations( + Arrays + .asList( + new AzureFirewallIpConfiguration() + .withName("azureFirewallIpConfiguration") + .withSubnet( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet")) + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName")))) + .withThreatIntelMode(AzureFirewallThreatIntelMode.ALERT) + .withSku( + new AzureFirewallSku() + .withName(AzureFirewallSkuName.AZFW_VNET) + .withTier(AzureFirewallSkuTier.STANDARD)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AzureFirewallPut.json + */ + /** + * Sample code: Create Azure Firewall. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAzureFirewall(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getAzureFirewalls() + .createOrUpdate( + "rg1", + "azurefirewall", + new AzureFirewallInner() + .withLocation("West US") + .withTags(mapOf("key1", "value1")) + .withZones(Arrays.asList()) + .withApplicationRuleCollections( + Arrays + .asList( + new AzureFirewallApplicationRuleCollection() + .withName("apprulecoll") + .withPriority(110) + .withAction(new AzureFirewallRCAction().withType(AzureFirewallRCActionType.DENY)) + .withRules( + Arrays + .asList( + new AzureFirewallApplicationRule() + .withName("rule1") + .withDescription("Deny inbound rule") + .withSourceAddresses(Arrays.asList("216.58.216.164", "10.0.0.0/24")) + .withProtocols( + Arrays + .asList( + new AzureFirewallApplicationRuleProtocol() + .withProtocolType( + AzureFirewallApplicationRuleProtocolType.HTTPS) + .withPort(443))) + .withTargetFqdns(Arrays.asList("www.test.com")))))) + .withNatRuleCollections( + Arrays + .asList( + new AzureFirewallNatRuleCollection() + .withName("natrulecoll") + .withPriority(112) + .withAction( + new AzureFirewallNatRCAction().withType(AzureFirewallNatRCActionType.DNAT)) + .withRules( + Arrays + .asList( + new AzureFirewallNatRule() + .withName("DNAT-HTTPS-traffic") + .withDescription("D-NAT all outbound web traffic for inspection") + .withSourceAddresses(Arrays.asList("*")) + .withDestinationAddresses(Arrays.asList("1.2.3.4")) + .withDestinationPorts(Arrays.asList("443")) + .withProtocols(Arrays.asList(AzureFirewallNetworkRuleProtocol.TCP)) + .withTranslatedAddress("1.2.3.5") + .withTranslatedPort("8443"), + new AzureFirewallNatRule() + .withName("DNAT-HTTP-traffic-With-FQDN") + .withDescription("D-NAT all inbound web traffic for inspection") + .withSourceAddresses(Arrays.asList("*")) + .withDestinationAddresses(Arrays.asList("1.2.3.4")) + .withDestinationPorts(Arrays.asList("80")) + .withProtocols(Arrays.asList(AzureFirewallNetworkRuleProtocol.TCP)) + .withTranslatedPort("880") + .withTranslatedFqdn("internalhttpserver"))))) + .withNetworkRuleCollections( + Arrays + .asList( + new AzureFirewallNetworkRuleCollection() + .withName("netrulecoll") + .withPriority(112) + .withAction(new AzureFirewallRCAction().withType(AzureFirewallRCActionType.DENY)) + .withRules( + Arrays + .asList( + new AzureFirewallNetworkRule() + .withName("L4-traffic") + .withDescription("Block traffic based on source IPs and ports") + .withProtocols(Arrays.asList(AzureFirewallNetworkRuleProtocol.TCP)) + .withSourceAddresses( + Arrays + .asList("192.168.1.1-192.168.1.12", "10.1.4.12-10.1.4.255")) + .withDestinationAddresses(Arrays.asList("*")) + .withDestinationPorts(Arrays.asList("443-444", "8443")), + new AzureFirewallNetworkRule() + .withName("L4-traffic-with-FQDN") + .withDescription( + "Block traffic based on source IPs and ports to amazon") + .withProtocols(Arrays.asList(AzureFirewallNetworkRuleProtocol.TCP)) + .withSourceAddresses(Arrays.asList("10.2.4.12-10.2.4.255")) + .withDestinationPorts(Arrays.asList("443-444", "8443")) + .withDestinationFqdns(Arrays.asList("www.amazon.com")))))) + .withIpConfigurations( + Arrays + .asList( + new AzureFirewallIpConfiguration() + .withName("azureFirewallIpConfiguration") + .withSubnet( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet")) + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName")))) + .withThreatIntelMode(AzureFirewallThreatIntelMode.ALERT) + .withSku( + new AzureFirewallSku() + .withName(AzureFirewallSkuName.AZFW_VNET) + .withTier(AzureFirewallSkuTier.STANDARD)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AzureFirewallPutWithAdditionalProperties.json + */ + /** + * Sample code: Create Azure Firewall With Additional Properties. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAzureFirewallWithAdditionalProperties( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getAzureFirewalls() + .createOrUpdate( + "rg1", + "azurefirewall", + new AzureFirewallInner() + .withLocation("West US") + .withTags(mapOf("key1", "value1")) + .withZones(Arrays.asList()) + .withApplicationRuleCollections( + Arrays + .asList( + new AzureFirewallApplicationRuleCollection() + .withName("apprulecoll") + .withPriority(110) + .withAction(new AzureFirewallRCAction().withType(AzureFirewallRCActionType.DENY)) + .withRules( + Arrays + .asList( + new AzureFirewallApplicationRule() + .withName("rule1") + .withDescription("Deny inbound rule") + .withSourceAddresses(Arrays.asList("216.58.216.164", "10.0.0.0/24")) + .withProtocols( + Arrays + .asList( + new AzureFirewallApplicationRuleProtocol() + .withProtocolType( + AzureFirewallApplicationRuleProtocolType.HTTPS) + .withPort(443))) + .withTargetFqdns(Arrays.asList("www.test.com")))))) + .withNatRuleCollections( + Arrays + .asList( + new AzureFirewallNatRuleCollection() + .withName("natrulecoll") + .withPriority(112) + .withAction( + new AzureFirewallNatRCAction().withType(AzureFirewallNatRCActionType.DNAT)) + .withRules( + Arrays + .asList( + new AzureFirewallNatRule() + .withName("DNAT-HTTPS-traffic") + .withDescription("D-NAT all outbound web traffic for inspection") + .withSourceAddresses(Arrays.asList("*")) + .withDestinationAddresses(Arrays.asList("1.2.3.4")) + .withDestinationPorts(Arrays.asList("443")) + .withProtocols(Arrays.asList(AzureFirewallNetworkRuleProtocol.TCP)) + .withTranslatedAddress("1.2.3.5") + .withTranslatedPort("8443"), + new AzureFirewallNatRule() + .withName("DNAT-HTTP-traffic-With-FQDN") + .withDescription("D-NAT all inbound web traffic for inspection") + .withSourceAddresses(Arrays.asList("*")) + .withDestinationAddresses(Arrays.asList("1.2.3.4")) + .withDestinationPorts(Arrays.asList("80")) + .withProtocols(Arrays.asList(AzureFirewallNetworkRuleProtocol.TCP)) + .withTranslatedPort("880") + .withTranslatedFqdn("internalhttpserver"))))) + .withNetworkRuleCollections( + Arrays + .asList( + new AzureFirewallNetworkRuleCollection() + .withName("netrulecoll") + .withPriority(112) + .withAction(new AzureFirewallRCAction().withType(AzureFirewallRCActionType.DENY)) + .withRules( + Arrays + .asList( + new AzureFirewallNetworkRule() + .withName("L4-traffic") + .withDescription("Block traffic based on source IPs and ports") + .withProtocols(Arrays.asList(AzureFirewallNetworkRuleProtocol.TCP)) + .withSourceAddresses( + Arrays + .asList("192.168.1.1-192.168.1.12", "10.1.4.12-10.1.4.255")) + .withDestinationAddresses(Arrays.asList("*")) + .withDestinationPorts(Arrays.asList("443-444", "8443")), + new AzureFirewallNetworkRule() + .withName("L4-traffic-with-FQDN") + .withDescription( + "Block traffic based on source IPs and ports to amazon") + .withProtocols(Arrays.asList(AzureFirewallNetworkRuleProtocol.TCP)) + .withSourceAddresses(Arrays.asList("10.2.4.12-10.2.4.255")) + .withDestinationPorts(Arrays.asList("443-444", "8443")) + .withDestinationFqdns(Arrays.asList("www.amazon.com")))))) + .withIpConfigurations( + Arrays + .asList( + new AzureFirewallIpConfiguration() + .withName("azureFirewallIpConfiguration") + .withSubnet( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet")) + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName")))) + .withThreatIntelMode(AzureFirewallThreatIntelMode.ALERT) + .withSku( + new AzureFirewallSku() + .withName(AzureFirewallSkuName.AZFW_VNET) + .withTier(AzureFirewallSkuTier.STANDARD)) + .withAdditionalProperties(mapOf("key1", "value1", "key2", "value2")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AzureFirewallPutInHub.json + */ + /** + * Sample code: Create Azure Firewall in virtual Hub. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAzureFirewallInVirtualHub(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getAzureFirewalls() + .createOrUpdate( + "rg1", + "azurefirewall", + new AzureFirewallInner() + .withLocation("West US") + .withTags(mapOf("key1", "value1")) + .withZones(Arrays.asList()) + .withThreatIntelMode(AzureFirewallThreatIntelMode.ALERT) + .withVirtualHub( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1")) + .withFirewallPolicy( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/policy1")) + .withHubIpAddresses( + new HubIpAddresses() + .withPublicIPs(new HubPublicIpAddresses().withAddresses(Arrays.asList()).withCount(1))) + .withSku( + new AzureFirewallSku() + .withName(AzureFirewallSkuName.AZFW_HUB) + .withTier(AzureFirewallSkuTier.STANDARD)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AzureFirewallPutWithMgmtSubnet.json + */ + /** + * Sample code: Create Azure Firewall With management subnet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createAzureFirewallWithManagementSubnet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getAzureFirewalls() + .createOrUpdate( + "rg1", + "azurefirewall", + new AzureFirewallInner() + .withLocation("West US") + .withTags(mapOf("key1", "value1")) + .withZones(Arrays.asList()) + .withApplicationRuleCollections( + Arrays + .asList( + new AzureFirewallApplicationRuleCollection() + .withName("apprulecoll") + .withPriority(110) + .withAction(new AzureFirewallRCAction().withType(AzureFirewallRCActionType.DENY)) + .withRules( + Arrays + .asList( + new AzureFirewallApplicationRule() + .withName("rule1") + .withDescription("Deny inbound rule") + .withSourceAddresses(Arrays.asList("216.58.216.164", "10.0.0.0/24")) + .withProtocols( + Arrays + .asList( + new AzureFirewallApplicationRuleProtocol() + .withProtocolType( + AzureFirewallApplicationRuleProtocolType.HTTPS) + .withPort(443))) + .withTargetFqdns(Arrays.asList("www.test.com")))))) + .withNatRuleCollections( + Arrays + .asList( + new AzureFirewallNatRuleCollection() + .withName("natrulecoll") + .withPriority(112) + .withAction( + new AzureFirewallNatRCAction().withType(AzureFirewallNatRCActionType.DNAT)) + .withRules( + Arrays + .asList( + new AzureFirewallNatRule() + .withName("DNAT-HTTPS-traffic") + .withDescription("D-NAT all outbound web traffic for inspection") + .withSourceAddresses(Arrays.asList("*")) + .withDestinationAddresses(Arrays.asList("1.2.3.4")) + .withDestinationPorts(Arrays.asList("443")) + .withProtocols(Arrays.asList(AzureFirewallNetworkRuleProtocol.TCP)) + .withTranslatedAddress("1.2.3.5") + .withTranslatedPort("8443"), + new AzureFirewallNatRule() + .withName("DNAT-HTTP-traffic-With-FQDN") + .withDescription("D-NAT all inbound web traffic for inspection") + .withSourceAddresses(Arrays.asList("*")) + .withDestinationAddresses(Arrays.asList("1.2.3.4")) + .withDestinationPorts(Arrays.asList("80")) + .withProtocols(Arrays.asList(AzureFirewallNetworkRuleProtocol.TCP)) + .withTranslatedPort("880") + .withTranslatedFqdn("internalhttpserver"))))) + .withNetworkRuleCollections( + Arrays + .asList( + new AzureFirewallNetworkRuleCollection() + .withName("netrulecoll") + .withPriority(112) + .withAction(new AzureFirewallRCAction().withType(AzureFirewallRCActionType.DENY)) + .withRules( + Arrays + .asList( + new AzureFirewallNetworkRule() + .withName("L4-traffic") + .withDescription("Block traffic based on source IPs and ports") + .withProtocols(Arrays.asList(AzureFirewallNetworkRuleProtocol.TCP)) + .withSourceAddresses( + Arrays + .asList("192.168.1.1-192.168.1.12", "10.1.4.12-10.1.4.255")) + .withDestinationAddresses(Arrays.asList("*")) + .withDestinationPorts(Arrays.asList("443-444", "8443")), + new AzureFirewallNetworkRule() + .withName("L4-traffic-with-FQDN") + .withDescription( + "Block traffic based on source IPs and ports to amazon") + .withProtocols(Arrays.asList(AzureFirewallNetworkRuleProtocol.TCP)) + .withSourceAddresses(Arrays.asList("10.2.4.12-10.2.4.255")) + .withDestinationPorts(Arrays.asList("443-444", "8443")) + .withDestinationFqdns(Arrays.asList("www.amazon.com")))))) + .withIpConfigurations( + Arrays + .asList( + new AzureFirewallIpConfiguration() + .withName("azureFirewallIpConfiguration") + .withSubnet( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallSubnet")) + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName")))) + .withManagementIpConfiguration( + new AzureFirewallIpConfiguration() + .withName("azureFirewallMgmtIpConfiguration") + .withSubnet( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/AzureFirewallManagementSubnet")) + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/managementPipName"))) + .withThreatIntelMode(AzureFirewallThreatIntelMode.ALERT) + .withSku( + new AzureFirewallSku() + .withName(AzureFirewallSkuName.AZFW_VNET) + .withTier(AzureFirewallSkuTier.STANDARD)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AzureFirewallsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AzureFirewallsDeleteSamples.java new file mode 100644 index 0000000000000..fe51e9cb038cf --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AzureFirewallsDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for AzureFirewalls Delete. */ +public final class AzureFirewallsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AzureFirewallDelete.json + */ + /** + * Sample code: Delete Azure Firewall. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteAzureFirewall(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getAzureFirewalls().delete("rg1", "azurefirewall", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AzureFirewallsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AzureFirewallsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..c22a3e9489b44 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AzureFirewallsGetByResourceGroupSamples.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for AzureFirewalls GetByResourceGroup. */ +public final class AzureFirewallsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AzureFirewallGetWithAdditionalProperties.json + */ + /** + * Sample code: Get Azure Firewall With Additional Properties. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAzureFirewallWithAdditionalProperties(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getAzureFirewalls() + .getByResourceGroupWithResponse("rg1", "azurefirewall", Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AzureFirewallGetWithIpGroups.json + */ + /** + * Sample code: Get Azure Firewall With IpGroups. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAzureFirewallWithIpGroups(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getAzureFirewalls() + .getByResourceGroupWithResponse("rg1", "azurefirewall", Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AzureFirewallGetWithZones.json + */ + /** + * Sample code: Get Azure Firewall With Zones. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAzureFirewallWithZones(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getAzureFirewalls() + .getByResourceGroupWithResponse("rg1", "azurefirewall", Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AzureFirewallGetWithMgmtSubnet.json + */ + /** + * Sample code: Get Azure Firewall With management subnet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAzureFirewallWithManagementSubnet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getAzureFirewalls() + .getByResourceGroupWithResponse("rg1", "azurefirewall", Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AzureFirewallGet.json + */ + /** + * Sample code: Get Azure Firewall. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAzureFirewall(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getAzureFirewalls() + .getByResourceGroupWithResponse("rg1", "azurefirewall", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AzureFirewallsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AzureFirewallsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..1b7e952f8572b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AzureFirewallsListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for AzureFirewalls ListByResourceGroup. */ +public final class AzureFirewallsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AzureFirewallListByResourceGroup.json + */ + /** + * Sample code: List all Azure Firewalls for a given resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllAzureFirewallsForAGivenResourceGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getAzureFirewalls().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AzureFirewallsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AzureFirewallsListSamples.java new file mode 100644 index 0000000000000..a3da5dd6a193a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AzureFirewallsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for AzureFirewalls List. */ +public final class AzureFirewallsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AzureFirewallListBySubscription.json + */ + /** + * Sample code: List all Azure Firewalls for a given subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllAzureFirewallsForAGivenSubscription( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getAzureFirewalls().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AzureFirewallsUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AzureFirewallsUpdateTagsSamples.java new file mode 100644 index 0000000000000..25ca635ecf9a8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/AzureFirewallsUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AzureFirewalls UpdateTags. */ +public final class AzureFirewallsUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AzureFirewallUpdateTags.json + */ + /** + * Sample code: Update Azure Firewall Tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateAzureFirewallTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getAzureFirewalls() + .updateTags( + "azfwtest", "fw1", new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/BastionHostsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/BastionHostsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..2ff7c5b55e932 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/BastionHostsCreateOrUpdateSamples.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.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.BastionHostInner; +import com.azure.resourcemanager.network.models.BastionHostIpConfiguration; +import java.util.Arrays; + +/** Samples for BastionHosts CreateOrUpdate. */ +public final class BastionHostsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/BastionHostPut.json + */ + /** + * Sample code: Create Bastion Host. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createBastionHost(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getBastionHosts() + .createOrUpdate( + "rg1", + "bastionhosttenant", + new BastionHostInner() + .withIpConfigurations( + Arrays + .asList( + new BastionHostIpConfiguration() + .withName("bastionHostIpConfiguration") + .withSubnet( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/BastionHostSubnet")) + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pipName")))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/BastionHostsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/BastionHostsDeleteSamples.java new file mode 100644 index 0000000000000..0e09a1fde08b4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/BastionHostsDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for BastionHosts Delete. */ +public final class BastionHostsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/BastionHostDelete.json + */ + /** + * Sample code: Delete Bastion Host. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteBastionHost(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getBastionHosts().delete("rg1", "bastionhosttenant", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/BastionHostsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/BastionHostsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..9a1e33f1c2020 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/BastionHostsGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for BastionHosts GetByResourceGroup. */ +public final class BastionHostsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/BastionHostGet.json + */ + /** + * Sample code: Get Bastion Host. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getBastionHost(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getBastionHosts() + .getByResourceGroupWithResponse("rg1", "bastionhosttenant'", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/BastionHostsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/BastionHostsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..64fdef6247efa --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/BastionHostsListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for BastionHosts ListByResourceGroup. */ +public final class BastionHostsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/BastionHostListByResourceGroup.json + */ + /** + * Sample code: List all Bastion Hosts for a given resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllBastionHostsForAGivenResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getBastionHosts().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/BastionHostsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/BastionHostsListSamples.java new file mode 100644 index 0000000000000..d5285e775aaae --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/BastionHostsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for BastionHosts List. */ +public final class BastionHostsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/BastionHostListBySubscription.json + */ + /** + * Sample code: List all Bastion Hosts for a given subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllBastionHostsForAGivenSubscription(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getBastionHosts().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/BastionHostsUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/BastionHostsUpdateTagsSamples.java new file mode 100644 index 0000000000000..305cb73aa3d39 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/BastionHostsUpdateTagsSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for BastionHosts UpdateTags. */ +public final class BastionHostsUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/BastionHostPatch.json + */ + /** + * Sample code: Patch Bastion Host. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void patchBastionHost(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getBastionHosts() + .updateTags( + "rg1", + "bastionhosttenant", + new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/BgpServiceCommunitiesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/BgpServiceCommunitiesListSamples.java new file mode 100644 index 0000000000000..43bbe307f66c5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/BgpServiceCommunitiesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for BgpServiceCommunities List. */ +public final class BgpServiceCommunitiesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ServiceCommunityList.json + */ + /** + * Sample code: ServiceCommunityList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void serviceCommunityList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getBgpServiceCommunities().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..a769b5bc19bb0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsCreateOrUpdateSamples.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.ConnectionMonitorInner; +import com.azure.resourcemanager.network.models.ConnectionMonitorEndpoint; +import com.azure.resourcemanager.network.models.ConnectionMonitorEndpointFilter; +import com.azure.resourcemanager.network.models.ConnectionMonitorEndpointFilterItem; +import com.azure.resourcemanager.network.models.ConnectionMonitorEndpointFilterItemType; +import com.azure.resourcemanager.network.models.ConnectionMonitorEndpointFilterType; +import com.azure.resourcemanager.network.models.ConnectionMonitorTcpConfiguration; +import com.azure.resourcemanager.network.models.ConnectionMonitorTestConfiguration; +import com.azure.resourcemanager.network.models.ConnectionMonitorTestConfigurationProtocol; +import com.azure.resourcemanager.network.models.ConnectionMonitorTestGroup; +import java.util.Arrays; + +/** Samples for ConnectionMonitors CreateOrUpdate. */ +public final class ConnectionMonitorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherConnectionMonitorCreate.json + */ + /** + * Sample code: Create connection monitor V1. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createConnectionMonitorV1(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getConnectionMonitors() + .createOrUpdate( + "rg1", + "nw1", + "cm1", + new ConnectionMonitorInner() + .withLocation("eastus") + .withEndpoints( + Arrays + .asList( + new ConnectionMonitorEndpoint() + .withName("source") + .withResourceId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/ct1"), + new ConnectionMonitorEndpoint().withName("destination").withAddress("bing.com"))) + .withTestConfigurations( + Arrays + .asList( + new ConnectionMonitorTestConfiguration() + .withName("tcp") + .withTestFrequencySec(60) + .withProtocol(ConnectionMonitorTestConfigurationProtocol.TCP) + .withTcpConfiguration(new ConnectionMonitorTcpConfiguration().withPort(80)))) + .withTestGroups( + Arrays + .asList( + new ConnectionMonitorTestGroup() + .withName("tg") + .withTestConfigurations(Arrays.asList("tcp")) + .withSources(Arrays.asList("source")) + .withDestinations(Arrays.asList("destination")))), + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherConnectionMonitorV2Create.json + */ + /** + * Sample code: Create connection monitor V2. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createConnectionMonitorV2(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getConnectionMonitors() + .createOrUpdate( + "rg1", + "nw1", + "cm1", + new ConnectionMonitorInner() + .withEndpoints( + Arrays + .asList( + new ConnectionMonitorEndpoint() + .withName("vm1") + .withResourceId( + "/subscriptions/96e68903-0a56-4819-9987-8d08ad6a1f99/resourceGroups/NwRgIrinaCentralUSEUAP/providers/Microsoft.Compute/virtualMachines/vm1"), + new ConnectionMonitorEndpoint() + .withName("CanaryWorkspaceVamshi") + .withResourceId( + "/subscriptions/96e68903-0a56-4819-9987-8d08ad6a1f99/resourceGroups/vasamudrRG/providers/Microsoft.OperationalInsights/workspaces/vasamudrWorkspace") + .withFilter( + new ConnectionMonitorEndpointFilter() + .withType(ConnectionMonitorEndpointFilterType.INCLUDE) + .withItems( + Arrays + .asList( + new ConnectionMonitorEndpointFilterItem() + .withType( + ConnectionMonitorEndpointFilterItemType.AGENT_ADDRESS) + .withAddress("npmuser")))), + new ConnectionMonitorEndpoint().withName("bing").withAddress("bing.com"), + new ConnectionMonitorEndpoint().withName("google").withAddress("google.com"))) + .withTestConfigurations( + Arrays + .asList( + new ConnectionMonitorTestConfiguration() + .withName("testConfig1") + .withTestFrequencySec(60) + .withProtocol(ConnectionMonitorTestConfigurationProtocol.TCP) + .withTcpConfiguration( + new ConnectionMonitorTcpConfiguration() + .withPort(80) + .withDisableTraceRoute(false)))) + .withTestGroups( + Arrays + .asList( + new ConnectionMonitorTestGroup() + .withName("test1") + .withDisable(false) + .withTestConfigurations(Arrays.asList("testConfig1")) + .withSources(Arrays.asList("vm1", "CanaryWorkspaceVamshi")) + .withDestinations(Arrays.asList("bing", "google")))) + .withOutputs(Arrays.asList()), + null, + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsDeleteSamples.java new file mode 100644 index 0000000000000..bd9c5884f2d4e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ConnectionMonitors Delete. */ +public final class ConnectionMonitorsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherConnectionMonitorDelete.json + */ + /** + * Sample code: Delete connection monitor. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteConnectionMonitor(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getConnectionMonitors().delete("rg1", "nw1", "cm1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsGetSamples.java new file mode 100644 index 0000000000000..e5784f547dc46 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ConnectionMonitors Get. */ +public final class ConnectionMonitorsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherConnectionMonitorGet.json + */ + /** + * Sample code: Get connection monitor. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getConnectionMonitor(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getConnectionMonitors() + .getWithResponse("rg1", "nw1", "cm1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsListSamples.java new file mode 100644 index 0000000000000..7e697d91533e3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ConnectionMonitors List. */ +public final class ConnectionMonitorsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherConnectionMonitorList.json + */ + /** + * Sample code: List connection monitors. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listConnectionMonitors(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getConnectionMonitors().list("rg1", "nw1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsQuerySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsQuerySamples.java new file mode 100644 index 0000000000000..ded82e01286bd --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsQuerySamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ConnectionMonitors Query. */ +public final class ConnectionMonitorsQuerySamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherConnectionMonitorQuery.json + */ + /** + * Sample code: Query connection monitor. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void queryConnectionMonitor(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getConnectionMonitors().query("rg1", "nw1", "cm1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsStartSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsStartSamples.java new file mode 100644 index 0000000000000..6ed47ec39b7dd --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsStartSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ConnectionMonitors Start. */ +public final class ConnectionMonitorsStartSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherConnectionMonitorStart.json + */ + /** + * Sample code: Start connection monitor. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void startConnectionMonitor(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getConnectionMonitors().start("rg1", "nw1", "cm1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsStopSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsStopSamples.java new file mode 100644 index 0000000000000..22f13f4df5871 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsStopSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ConnectionMonitors Stop. */ +public final class ConnectionMonitorsStopSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherConnectionMonitorStop.json + */ + /** + * Sample code: Stop connection monitor. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void stopConnectionMonitor(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getConnectionMonitors().stop("rg1", "nw1", "cm1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsUpdateTagsSamples.java new file mode 100644 index 0000000000000..557c0916b03ae --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ConnectionMonitorsUpdateTagsSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ConnectionMonitors UpdateTags. */ +public final class ConnectionMonitorsUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherConnectionMonitorUpdateTags.json + */ + /** + * Sample code: Update connection monitor tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateConnectionMonitorTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getConnectionMonitors() + .updateTagsWithResponse( + "rg1", + "nw1", + "cm1", + new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/CustomIpPrefixesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/CustomIpPrefixesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..8e22bbafd0338 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/CustomIpPrefixesCreateOrUpdateSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.CustomIpPrefixInner; + +/** Samples for CustomIpPrefixes CreateOrUpdate. */ +public final class CustomIpPrefixesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/CustomIpPrefixCreateCustomizedValues.json + */ + /** + * Sample code: Create custom IP prefix allocation method. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createCustomIPPrefixAllocationMethod(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getCustomIpPrefixes() + .createOrUpdate( + "rg1", + "test-customipprefix", + new CustomIpPrefixInner().withLocation("westus").withCidr("0.0.0.0/24"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/CustomIpPrefixesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/CustomIpPrefixesDeleteSamples.java new file mode 100644 index 0000000000000..19bdcf5706c27 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/CustomIpPrefixesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for CustomIpPrefixes Delete. */ +public final class CustomIpPrefixesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/CustomIpPrefixDelete.json + */ + /** + * Sample code: Delete custom IP prefix. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteCustomIPPrefix(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getCustomIpPrefixes() + .delete("rg1", "test-customipprefix", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/CustomIpPrefixesGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/CustomIpPrefixesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..e390cfe76c82a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/CustomIpPrefixesGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for CustomIpPrefixes GetByResourceGroup. */ +public final class CustomIpPrefixesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/CustomIpPrefixGet.json + */ + /** + * Sample code: Get custom IP prefix. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getCustomIPPrefix(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getCustomIpPrefixes() + .getByResourceGroupWithResponse("rg1", "test-customipprefix", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/CustomIpPrefixesListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/CustomIpPrefixesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..d020bb5790a16 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/CustomIpPrefixesListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for CustomIpPrefixes ListByResourceGroup. */ +public final class CustomIpPrefixesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/CustomIpPrefixList.json + */ + /** + * Sample code: List resource group Custom IP prefixes. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listResourceGroupCustomIPPrefixes(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getCustomIpPrefixes().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/CustomIpPrefixesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/CustomIpPrefixesListSamples.java new file mode 100644 index 0000000000000..10daf658da243 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/CustomIpPrefixesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for CustomIpPrefixes List. */ +public final class CustomIpPrefixesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/CustomIpPrefixListAll.json + */ + /** + * Sample code: List all custom IP prefixes. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllCustomIPPrefixes(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getCustomIpPrefixes().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/CustomIpPrefixesUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/CustomIpPrefixesUpdateTagsSamples.java new file mode 100644 index 0000000000000..f2ebd53cc51e1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/CustomIpPrefixesUpdateTagsSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for CustomIpPrefixes UpdateTags. */ +public final class CustomIpPrefixesUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/CustomIpPrefixUpdateTags.json + */ + /** + * Sample code: Update public IP address tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updatePublicIPAddressTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getCustomIpPrefixes() + .updateTagsWithResponse( + "rg1", + "test-customipprefix", + new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosCustomPoliciesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosCustomPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..78de080794236 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosCustomPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.DdosCustomPolicyInner; +import com.azure.resourcemanager.network.models.DdosCustomPolicyProtocol; +import com.azure.resourcemanager.network.models.ProtocolCustomSettingsFormat; +import java.util.Arrays; + +/** Samples for DdosCustomPolicies CreateOrUpdate. */ +public final class DdosCustomPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/DdosCustomPolicyCreate.json + */ + /** + * Sample code: Create DDoS custom policy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createDDoSCustomPolicy(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getDdosCustomPolicies() + .createOrUpdate( + "rg1", + "test-ddos-custom-policy", + new DdosCustomPolicyInner() + .withLocation("centraluseuap") + .withProtocolCustomSettings( + Arrays.asList(new ProtocolCustomSettingsFormat().withProtocol(DdosCustomPolicyProtocol.TCP))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosCustomPoliciesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosCustomPoliciesDeleteSamples.java new file mode 100644 index 0000000000000..564e90d3414e1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosCustomPoliciesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for DdosCustomPolicies Delete. */ +public final class DdosCustomPoliciesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/DdosCustomPolicyDelete.json + */ + /** + * Sample code: Delete DDoS custom policy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteDDoSCustomPolicy(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getDdosCustomPolicies() + .delete("rg1", "test-ddos-custom-policy", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosCustomPoliciesGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosCustomPoliciesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..94acfd451bcb6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosCustomPoliciesGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for DdosCustomPolicies GetByResourceGroup. */ +public final class DdosCustomPoliciesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/DdosCustomPolicyGet.json + */ + /** + * Sample code: Get DDoS custom policy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getDDoSCustomPolicy(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getDdosCustomPolicies() + .getByResourceGroupWithResponse("rg1", "test-ddos-custom-policy", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosCustomPoliciesUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosCustomPoliciesUpdateTagsSamples.java new file mode 100644 index 0000000000000..322a5abdbca07 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosCustomPoliciesUpdateTagsSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DdosCustomPolicies UpdateTags. */ +public final class DdosCustomPoliciesUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/DdosCustomPolicyUpdateTags.json + */ + /** + * Sample code: DDoS Custom policy Update tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void dDoSCustomPolicyUpdateTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getDdosCustomPolicies() + .updateTagsWithResponse( + "rg1", + "test-ddos-custom-policy", + new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosProtectionPlansCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosProtectionPlansCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..6f7d87322f421 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosProtectionPlansCreateOrUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.DdosProtectionPlanInner; + +/** Samples for DdosProtectionPlans CreateOrUpdate. */ +public final class DdosProtectionPlansCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/DdosProtectionPlanCreate.json + */ + /** + * Sample code: Create DDoS protection plan. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createDDoSProtectionPlan(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getDdosProtectionPlans() + .createOrUpdate("rg1", "test-plan", new DdosProtectionPlanInner().withLocation("westus"), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosProtectionPlansDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosProtectionPlansDeleteSamples.java new file mode 100644 index 0000000000000..41fb8aff2e89d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosProtectionPlansDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for DdosProtectionPlans Delete. */ +public final class DdosProtectionPlansDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/DdosProtectionPlanDelete.json + */ + /** + * Sample code: Delete DDoS protection plan. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteDDoSProtectionPlan(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getDdosProtectionPlans().delete("rg1", "test-plan", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosProtectionPlansGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosProtectionPlansGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..be9d75af07240 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosProtectionPlansGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for DdosProtectionPlans GetByResourceGroup. */ +public final class DdosProtectionPlansGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/DdosProtectionPlanGet.json + */ + /** + * Sample code: Get DDoS protection plan. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getDDoSProtectionPlan(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getDdosProtectionPlans() + .getByResourceGroupWithResponse("rg1", "test-plan", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosProtectionPlansListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosProtectionPlansListByResourceGroupSamples.java new file mode 100644 index 0000000000000..d91329ce65ee9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosProtectionPlansListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for DdosProtectionPlans ListByResourceGroup. */ +public final class DdosProtectionPlansListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/DdosProtectionPlanList.json + */ + /** + * Sample code: List DDoS protection plans in resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listDDoSProtectionPlansInResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getDdosProtectionPlans().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosProtectionPlansListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosProtectionPlansListSamples.java new file mode 100644 index 0000000000000..7a19532fc3316 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosProtectionPlansListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for DdosProtectionPlans List. */ +public final class DdosProtectionPlansListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/DdosProtectionPlanListAll.json + */ + /** + * Sample code: List all DDoS protection plans. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllDDoSProtectionPlans(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getDdosProtectionPlans().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosProtectionPlansUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosProtectionPlansUpdateTagsSamples.java new file mode 100644 index 0000000000000..a21edcba96fbb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DdosProtectionPlansUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DdosProtectionPlans UpdateTags. */ +public final class DdosProtectionPlansUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/DdosProtectionPlanUpdateTags.json + */ + /** + * Sample code: DDoS protection plan Update tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void dDoSProtectionPlanUpdateTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getDdosProtectionPlans() + .updateTagsWithResponse( + "rg1", "test-plan", new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DefaultSecurityRulesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DefaultSecurityRulesGetSamples.java new file mode 100644 index 0000000000000..03923cd1f8f94 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DefaultSecurityRulesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for DefaultSecurityRules Get. */ +public final class DefaultSecurityRulesGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/DefaultSecurityRuleGet.json + */ + /** + * Sample code: DefaultSecurityRuleGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void defaultSecurityRuleGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getDefaultSecurityRules() + .getWithResponse("testrg", "nsg1", "AllowVnetInBound", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DefaultSecurityRulesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DefaultSecurityRulesListSamples.java new file mode 100644 index 0000000000000..51601a3a85e51 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DefaultSecurityRulesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for DefaultSecurityRules List. */ +public final class DefaultSecurityRulesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/DefaultSecurityRuleList.json + */ + /** + * Sample code: DefaultSecurityRuleList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void defaultSecurityRuleList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getDefaultSecurityRules().list("testrg", "nsg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DscpConfigurationCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DscpConfigurationCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..d627e21684c1a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DscpConfigurationCreateOrUpdateSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.DscpConfigurationInner; +import com.azure.resourcemanager.network.models.ProtocolType; +import com.azure.resourcemanager.network.models.QosDefinition; +import com.azure.resourcemanager.network.models.QosIpRange; +import com.azure.resourcemanager.network.models.QosPortRange; +import java.util.Arrays; + +/** Samples for DscpConfiguration CreateOrUpdate. */ +public final class DscpConfigurationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/DscpConfigurationCreate.json + */ + /** + * Sample code: Create DSCP Configuration. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createDSCPConfiguration(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getDscpConfigurations() + .createOrUpdate( + "rg1", + "mydscpconfig", + new DscpConfigurationInner() + .withLocation("eastus") + .withQosDefinitionCollection( + Arrays + .asList( + new QosDefinition() + .withMarkings(Arrays.asList(1)) + .withSourceIpRanges( + Arrays.asList(new QosIpRange().withStartIp("127.0.0.1").withEndIp("127.0.0.2"))) + .withDestinationIpRanges( + Arrays + .asList(new QosIpRange().withStartIp("127.0.10.1").withEndIp("127.0.10.2"))) + .withSourcePortRanges( + Arrays + .asList( + new QosPortRange().withStart(10).withEnd(11), + new QosPortRange().withStart(20).withEnd(21))) + .withDestinationPortRanges( + Arrays.asList(new QosPortRange().withStart(15).withEnd(15))) + .withProtocol(ProtocolType.TCP), + new QosDefinition() + .withMarkings(Arrays.asList(2)) + .withSourceIpRanges( + Arrays.asList(new QosIpRange().withStartIp("12.0.0.1").withEndIp("12.0.0.2"))) + .withDestinationIpRanges( + Arrays.asList(new QosIpRange().withStartIp("12.0.10.1").withEndIp("12.0.10.2"))) + .withSourcePortRanges(Arrays.asList(new QosPortRange().withStart(11).withEnd(12))) + .withDestinationPortRanges( + Arrays.asList(new QosPortRange().withStart(51).withEnd(52))) + .withProtocol(ProtocolType.UDP))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DscpConfigurationDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DscpConfigurationDeleteSamples.java new file mode 100644 index 0000000000000..6f41704aee059 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DscpConfigurationDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for DscpConfiguration Delete. */ +public final class DscpConfigurationDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/DscpConfigurationDelete.json + */ + /** + * Sample code: Delete DSCP Configuration. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteDSCPConfiguration(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getDscpConfigurations().delete("rg1", "mydscpConfig", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DscpConfigurationGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DscpConfigurationGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..c6e93d15db8bc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DscpConfigurationGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for DscpConfiguration GetByResourceGroup. */ +public final class DscpConfigurationGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/DscpConfigurationGet.json + */ + /** + * Sample code: Get Dscp Configuration. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getDscpConfiguration(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getDscpConfigurations() + .getByResourceGroupWithResponse("rg1", "mydscpConfig", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DscpConfigurationListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DscpConfigurationListByResourceGroupSamples.java new file mode 100644 index 0000000000000..91e1716f4e360 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DscpConfigurationListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for DscpConfiguration ListByResourceGroup. */ +public final class DscpConfigurationListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/DscpConfigurationList.json + */ + /** + * Sample code: Get Dscp Configuration. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getDscpConfiguration(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getDscpConfigurations().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DscpConfigurationListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DscpConfigurationListSamples.java new file mode 100644 index 0000000000000..6e7b646ff8675 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/DscpConfigurationListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for DscpConfiguration List. */ +public final class DscpConfigurationListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/DscpConfigurationListAll.json + */ + /** + * Sample code: List all network interfaces. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllNetworkInterfaces(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getDscpConfigurations().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitAuthorizationsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitAuthorizationsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e24e4a6cdbc19 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitAuthorizationsCreateOrUpdateSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.ExpressRouteCircuitAuthorizationInner; + +/** Samples for ExpressRouteCircuitAuthorizations CreateOrUpdate. */ +public final class ExpressRouteCircuitAuthorizationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitAuthorizationCreate.json + */ + /** + * Sample code: Create ExpressRouteCircuit Authorization. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createExpressRouteCircuitAuthorization(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCircuitAuthorizations() + .createOrUpdate( + "rg1", "circuitName", "authorizatinName", new ExpressRouteCircuitAuthorizationInner(), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitAuthorizationsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitAuthorizationsDeleteSamples.java new file mode 100644 index 0000000000000..26d3821eb2ddb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitAuthorizationsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCircuitAuthorizations Delete. */ +public final class ExpressRouteCircuitAuthorizationsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitAuthorizationDelete.json + */ + /** + * Sample code: Delete ExpressRouteCircuit Authorization. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteExpressRouteCircuitAuthorization(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCircuitAuthorizations() + .delete("rg1", "circuitName", "authorizationName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitAuthorizationsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitAuthorizationsGetSamples.java new file mode 100644 index 0000000000000..268dd8d36f16e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitAuthorizationsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCircuitAuthorizations Get. */ +public final class ExpressRouteCircuitAuthorizationsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitAuthorizationGet.json + */ + /** + * Sample code: Get ExpressRouteCircuit Authorization. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getExpressRouteCircuitAuthorization(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCircuitAuthorizations() + .getWithResponse("rg1", "circuitName", "authorizationName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitAuthorizationsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitAuthorizationsListSamples.java new file mode 100644 index 0000000000000..7971a6bef2ab5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitAuthorizationsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCircuitAuthorizations List. */ +public final class ExpressRouteCircuitAuthorizationsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitAuthorizationList.json + */ + /** + * Sample code: List ExpressRouteCircuit Authorization. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listExpressRouteCircuitAuthorization(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCircuitAuthorizations() + .list("rg1", "circuitName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitConnectionsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitConnectionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..84b2232a06ab6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitConnectionsCreateOrUpdateSamples.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.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.ExpressRouteCircuitConnectionInner; +import com.azure.resourcemanager.network.models.Ipv6CircuitConnectionConfig; + +/** Samples for ExpressRouteCircuitConnections CreateOrUpdate. */ +public final class ExpressRouteCircuitConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitConnectionCreate.json + */ + /** + * Sample code: ExpressRouteCircuitConnectionCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRouteCircuitConnectionCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCircuitConnections() + .createOrUpdate( + "rg1", + "ExpressRouteARMCircuitA", + "AzurePrivatePeering", + "circuitConnectionUSAUS", + new ExpressRouteCircuitConnectionInner() + .withExpressRouteCircuitPeering( + new SubResource() + .withId( + "/subscriptions/subid1/resourceGroups/dedharcktinit/providers/Microsoft.Network/expressRouteCircuits/dedharcktlocal/peerings/AzurePrivatePeering")) + .withPeerExpressRouteCircuitPeering( + new SubResource() + .withId( + "/subscriptions/subid2/resourceGroups/dedharcktpeer/providers/Microsoft.Network/expressRouteCircuits/dedharcktremote/peerings/AzurePrivatePeering")) + .withAddressPrefix("10.0.0.0/29") + .withAuthorizationKey("946a1918-b7a2-4917-b43c-8c4cdaee006a") + .withIpv6CircuitConnectionConfig( + new Ipv6CircuitConnectionConfig().withAddressPrefix("aa:bb::/125")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitConnectionsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..c4eb697dc4c43 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitConnectionsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCircuitConnections Delete. */ +public final class ExpressRouteCircuitConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitConnectionDelete.json + */ + /** + * Sample code: Delete ExpressRouteCircuit. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteExpressRouteCircuit(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCircuitConnections() + .delete("rg1", "ExpressRouteARMCircuitA", "AzurePrivatePeering", "circuitConnectionUSAUS", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitConnectionsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitConnectionsGetSamples.java new file mode 100644 index 0000000000000..12340f68a09b0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitConnectionsGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCircuitConnections Get. */ +public final class ExpressRouteCircuitConnectionsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitConnectionGet.json + */ + /** + * Sample code: ExpressRouteCircuitConnectionGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRouteCircuitConnectionGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCircuitConnections() + .getWithResponse( + "rg1", "ExpressRouteARMCircuitA", "AzurePrivatePeering", "circuitConnectionUSAUS", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitConnectionsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitConnectionsListSamples.java new file mode 100644 index 0000000000000..bca22c973f3e3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitConnectionsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCircuitConnections List. */ +public final class ExpressRouteCircuitConnectionsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitConnectionList.json + */ + /** + * Sample code: List ExpressRouteCircuit Connection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listExpressRouteCircuitConnection(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCircuitConnections() + .list("rg1", "ExpressRouteARMCircuitA", "AzurePrivatePeering", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitPeeringsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitPeeringsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..2ab4eb37fad56 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitPeeringsCreateOrUpdateSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.ExpressRouteCircuitPeeringInner; + +/** Samples for ExpressRouteCircuitPeerings CreateOrUpdate. */ +public final class ExpressRouteCircuitPeeringsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitPeeringCreate.json + */ + /** + * Sample code: Create ExpressRouteCircuit Peerings. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createExpressRouteCircuitPeerings(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCircuitPeerings() + .createOrUpdate( + "rg1", + "circuitName", + "AzurePrivatePeering", + new ExpressRouteCircuitPeeringInner() + .withPeerAsn(200L) + .withPrimaryPeerAddressPrefix("192.168.16.252/30") + .withSecondaryPeerAddressPrefix("192.168.18.252/30") + .withVlanId(200), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitPeeringsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitPeeringsDeleteSamples.java new file mode 100644 index 0000000000000..8ea64a5331d49 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitPeeringsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCircuitPeerings Delete. */ +public final class ExpressRouteCircuitPeeringsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitPeeringDelete.json + */ + /** + * Sample code: Delete ExpressRouteCircuit Peerings. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteExpressRouteCircuitPeerings(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCircuitPeerings() + .delete("rg1", "circuitName", "peeringName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitPeeringsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitPeeringsGetSamples.java new file mode 100644 index 0000000000000..68426dde26b47 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitPeeringsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCircuitPeerings Get. */ +public final class ExpressRouteCircuitPeeringsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitPeeringGet.json + */ + /** + * Sample code: Get ExpressRouteCircuit Peering. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getExpressRouteCircuitPeering(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCircuitPeerings() + .getWithResponse("rg1", "circuitName", "MicrosoftPeering", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitPeeringsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitPeeringsListSamples.java new file mode 100644 index 0000000000000..63f6c72f3aca7 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitPeeringsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCircuitPeerings List. */ +public final class ExpressRouteCircuitPeeringsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitPeeringList.json + */ + /** + * Sample code: List ExpressRouteCircuit Peerings. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listExpressRouteCircuitPeerings(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCircuitPeerings() + .list("rg1", "circuitName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..9e642f6c56650 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsCreateOrUpdateSamples.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.ExpressRouteCircuitInner; +import com.azure.resourcemanager.network.models.ExpressRouteCircuitServiceProviderProperties; +import com.azure.resourcemanager.network.models.ExpressRouteCircuitSku; +import com.azure.resourcemanager.network.models.ExpressRouteCircuitSkuFamily; +import com.azure.resourcemanager.network.models.ExpressRouteCircuitSkuTier; +import java.util.Arrays; + +/** Samples for ExpressRouteCircuits CreateOrUpdate. */ +public final class ExpressRouteCircuitsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitCreate.json + */ + /** + * Sample code: Create ExpressRouteCircuit. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createExpressRouteCircuit(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCircuits() + .createOrUpdate( + "rg1", + "circuitName", + new ExpressRouteCircuitInner() + .withLocation("Brazil South") + .withSku( + new ExpressRouteCircuitSku() + .withName("Standard_MeteredData") + .withTier(ExpressRouteCircuitSkuTier.STANDARD) + .withFamily(ExpressRouteCircuitSkuFamily.METERED_DATA)) + .withAllowClassicOperations(false) + .withAuthorizations(Arrays.asList()) + .withPeerings(Arrays.asList()) + .withServiceProviderProperties( + new ExpressRouteCircuitServiceProviderProperties() + .withServiceProviderName("Equinix") + .withPeeringLocation("Silicon Valley") + .withBandwidthInMbps(200)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitCreateOnExpressRoutePort.json + */ + /** + * Sample code: Create ExpressRouteCircuit on ExpressRoutePort. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createExpressRouteCircuitOnExpressRoutePort( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCircuits() + .createOrUpdate( + "rg1", + "expressRouteCircuit1", + new ExpressRouteCircuitInner() + .withLocation("westus") + .withSku( + new ExpressRouteCircuitSku() + .withName("Premium_MeteredData") + .withTier(ExpressRouteCircuitSkuTier.PREMIUM) + .withFamily(ExpressRouteCircuitSkuFamily.METERED_DATA)) + .withExpressRoutePort( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/expressRoutePorts/portName")) + .withBandwidthInGbps(10.0f), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsDeleteSamples.java new file mode 100644 index 0000000000000..940454c59167d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCircuits Delete. */ +public final class ExpressRouteCircuitsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitDelete.json + */ + /** + * Sample code: Delete ExpressRouteCircuit. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteExpressRouteCircuit(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getExpressRouteCircuits().delete("rg1", "circuitName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..9ae8bedea0e39 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCircuits GetByResourceGroup. */ +public final class ExpressRouteCircuitsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitGet.json + */ + /** + * Sample code: Get ExpressRouteCircuit. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getExpressRouteCircuit(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCircuits() + .getByResourceGroupWithResponse("rg1", "circuitName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsGetPeeringStatsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsGetPeeringStatsSamples.java new file mode 100644 index 0000000000000..801aa86933c1f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsGetPeeringStatsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCircuits GetPeeringStats. */ +public final class ExpressRouteCircuitsGetPeeringStatsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitPeeringStats.json + */ + /** + * Sample code: Get ExpressRoute Circuit Peering Traffic Stats. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getExpressRouteCircuitPeeringTrafficStats(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCircuits() + .getPeeringStatsWithResponse("rg1", "circuitName", "peeringName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsGetStatsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsGetStatsSamples.java new file mode 100644 index 0000000000000..cabe47112630c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsGetStatsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCircuits GetStats. */ +public final class ExpressRouteCircuitsGetStatsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitStats.json + */ + /** + * Sample code: Get ExpressRoute Circuit Traffic Stats. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getExpressRouteCircuitTrafficStats(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCircuits() + .getStatsWithResponse("rg1", "circuitName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsListArpTableSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsListArpTableSamples.java new file mode 100644 index 0000000000000..5ff348dab5b26 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsListArpTableSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCircuits ListArpTable. */ +public final class ExpressRouteCircuitsListArpTableSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitARPTableList.json + */ + /** + * Sample code: List ARP Table. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listARPTable(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCircuits() + .listArpTable("rg1", "circuitName", "peeringName", "devicePath", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..bdda97a1e8a35 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCircuits ListByResourceGroup. */ +public final class ExpressRouteCircuitsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitListByResourceGroup.json + */ + /** + * Sample code: List ExpressRouteCircuits in a resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listExpressRouteCircuitsInAResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getExpressRouteCircuits().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsListRoutesTableSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsListRoutesTableSamples.java new file mode 100644 index 0000000000000..50e583f8506a1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsListRoutesTableSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCircuits ListRoutesTable. */ +public final class ExpressRouteCircuitsListRoutesTableSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitRouteTableList.json + */ + /** + * Sample code: List Route Tables. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listRouteTables(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCircuits() + .listRoutesTable("rg1", "circuitName", "peeringName", "devicePath", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsListRoutesTableSummarySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsListRoutesTableSummarySamples.java new file mode 100644 index 0000000000000..4b78621404fd0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsListRoutesTableSummarySamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCircuits ListRoutesTableSummary. */ +public final class ExpressRouteCircuitsListRoutesTableSummarySamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitRouteTableSummaryList.json + */ + /** + * Sample code: List Route Table Summary. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listRouteTableSummary(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCircuits() + .listRoutesTableSummary("rg1", "circuitName", "peeringName", "devicePath", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsListSamples.java new file mode 100644 index 0000000000000..b00a48bf594ea --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCircuits List. */ +public final class ExpressRouteCircuitsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitListBySubscription.json + */ + /** + * Sample code: List ExpressRouteCircuits in a subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listExpressRouteCircuitsInASubscription(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getExpressRouteCircuits().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsUpdateTagsSamples.java new file mode 100644 index 0000000000000..56572adc811ba --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCircuitsUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ExpressRouteCircuits UpdateTags. */ +public final class ExpressRouteCircuitsUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCircuitUpdateTags.json + */ + /** + * Sample code: Update Express Route Circuit Tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateExpressRouteCircuitTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCircuits() + .updateTagsWithResponse( + "ertest", "er1", new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteConnectionsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteConnectionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..66b15984667bf --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteConnectionsCreateOrUpdateSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.ExpressRouteConnectionInner; +import com.azure.resourcemanager.network.models.ExpressRouteCircuitPeeringId; + +/** Samples for ExpressRouteConnections CreateOrUpdate. */ +public final class ExpressRouteConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteConnectionCreate.json + */ + /** + * Sample code: ExpressRouteConnectionCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRouteConnectionCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteConnections() + .createOrUpdate( + "resourceGroupName", + "gateway-2", + "connectionName", + new ExpressRouteConnectionInner() + .withId( + "/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteGateways/gateway-2/expressRouteConnections/connectionName") + .withName("connectionName") + .withExpressRouteCircuitPeering( + new ExpressRouteCircuitPeeringId() + .withId( + "/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteCircuits/circuitName/peerings/AzurePrivatePeering")) + .withAuthorizationKey("authorizationKey") + .withRoutingWeight(2), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteConnectionsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..54dc98b66ea76 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteConnectionsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteConnections Delete. */ +public final class ExpressRouteConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteConnectionDelete.json + */ + /** + * Sample code: ExpressRouteConnectionDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRouteConnectionDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteConnections() + .delete("resourceGroupName", "expressRouteGatewayName", "connectionName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteConnectionsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteConnectionsGetSamples.java new file mode 100644 index 0000000000000..bbd2d653bc928 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteConnectionsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteConnections Get. */ +public final class ExpressRouteConnectionsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteConnectionGet.json + */ + /** + * Sample code: ExpressRouteConnectionGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRouteConnectionGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteConnections() + .getWithResponse("resourceGroupName", "expressRouteGatewayName", "connectionName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteConnectionsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteConnectionsListSamples.java new file mode 100644 index 0000000000000..91fec74164f18 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteConnectionsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteConnections List. */ +public final class ExpressRouteConnectionsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteConnectionList.json + */ + /** + * Sample code: ExpressRouteConnectionList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRouteConnectionList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteConnections() + .listWithResponse("resourceGroupName", "expressRouteGatewayName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionPeeringsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionPeeringsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..9c71397a6c86d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionPeeringsCreateOrUpdateSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.ExpressRouteCrossConnectionPeeringInner; +import com.azure.resourcemanager.network.models.Ipv6ExpressRouteCircuitPeeringConfig; + +/** Samples for ExpressRouteCrossConnectionPeerings CreateOrUpdate. */ +public final class ExpressRouteCrossConnectionPeeringsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCrossConnectionBgpPeeringCreate.json + */ + /** + * Sample code: ExpressRouteCrossConnectionBgpPeeringCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRouteCrossConnectionBgpPeeringCreate( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCrossConnectionPeerings() + .createOrUpdate( + "CrossConnection-SiliconValley", + "", + "AzurePrivatePeering", + new ExpressRouteCrossConnectionPeeringInner() + .withPeerAsn(200L) + .withPrimaryPeerAddressPrefix("192.168.16.252/30") + .withSecondaryPeerAddressPrefix("192.168.18.252/30") + .withVlanId(200) + .withIpv6PeeringConfig( + new Ipv6ExpressRouteCircuitPeeringConfig() + .withPrimaryPeerAddressPrefix("3FFE:FFFF:0:CD30::/126") + .withSecondaryPeerAddressPrefix("3FFE:FFFF:0:CD30::4/126")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionPeeringsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionPeeringsDeleteSamples.java new file mode 100644 index 0000000000000..cec8e0c821d8e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionPeeringsDeleteSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCrossConnectionPeerings Delete. */ +public final class ExpressRouteCrossConnectionPeeringsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCrossConnectionBgpPeeringDelete.json + */ + /** + * Sample code: DeleteExpressRouteCrossConnectionBgpPeering. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteExpressRouteCrossConnectionBgpPeering( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCrossConnectionPeerings() + .delete("CrossConnection-SiliconValley", "", "AzurePrivatePeering", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionPeeringsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionPeeringsGetSamples.java new file mode 100644 index 0000000000000..3478ad941a312 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionPeeringsGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCrossConnectionPeerings Get. */ +public final class ExpressRouteCrossConnectionPeeringsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCrossConnectionBgpPeeringGet.json + */ + /** + * Sample code: GetExpressRouteCrossConnectionBgpPeering. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getExpressRouteCrossConnectionBgpPeering(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCrossConnectionPeerings() + .getWithResponse( + "CrossConnection-SiliconValley", "", "AzurePrivatePeering", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionPeeringsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionPeeringsListSamples.java new file mode 100644 index 0000000000000..837f86b7ae24a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionPeeringsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCrossConnectionPeerings List. */ +public final class ExpressRouteCrossConnectionPeeringsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCrossConnectionBgpPeeringList.json + */ + /** + * Sample code: ExpressRouteCrossConnectionBgpPeeringList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRouteCrossConnectionBgpPeeringList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCrossConnectionPeerings() + .list("CrossConnection-SiliconValley", "", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..cdf977450698e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsCreateOrUpdateSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.ExpressRouteCrossConnectionInner; +import com.azure.resourcemanager.network.models.ServiceProviderProvisioningState; + +/** Samples for ExpressRouteCrossConnections CreateOrUpdate. */ +public final class ExpressRouteCrossConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCrossConnectionUpdate.json + */ + /** + * Sample code: UpdateExpressRouteCrossConnection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateExpressRouteCrossConnection(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCrossConnections() + .createOrUpdate( + "CrossConnection-SiliconValley", + "", + new ExpressRouteCrossConnectionInner() + .withServiceProviderProvisioningState(ServiceProviderProvisioningState.NOT_PROVISIONED), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..236332dbd9c2a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCrossConnections GetByResourceGroup. */ +public final class ExpressRouteCrossConnectionsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCrossConnectionGet.json + */ + /** + * Sample code: GetExpressRouteCrossConnection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getExpressRouteCrossConnection(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCrossConnections() + .getByResourceGroupWithResponse("CrossConnection-SiliconValley", "", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsListArpTableSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsListArpTableSamples.java new file mode 100644 index 0000000000000..a38f75cb88536 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsListArpTableSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCrossConnections ListArpTable. */ +public final class ExpressRouteCrossConnectionsListArpTableSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCrossConnectionsArpTable.json + */ + /** + * Sample code: GetExpressRouteCrossConnectionsArpTable. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getExpressRouteCrossConnectionsArpTable(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCrossConnections() + .listArpTable( + "CrossConnection-SiliconValley", "", "AzurePrivatePeering", "primary", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..3df6cce844c32 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsListByResourceGroupSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCrossConnections ListByResourceGroup. */ +public final class ExpressRouteCrossConnectionsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCrossConnectionListByResourceGroup.json + */ + /** + * Sample code: ExpressRouteCrossConnectionListByResourceGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRouteCrossConnectionListByResourceGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCrossConnections() + .listByResourceGroup("CrossConnection-SiliconValley", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsListRoutesTableSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsListRoutesTableSamples.java new file mode 100644 index 0000000000000..47b691bc74dc0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsListRoutesTableSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCrossConnections ListRoutesTable. */ +public final class ExpressRouteCrossConnectionsListRoutesTableSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCrossConnectionsRouteTable.json + */ + /** + * Sample code: GetExpressRouteCrossConnectionsRouteTable. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getExpressRouteCrossConnectionsRouteTable(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCrossConnections() + .listRoutesTable( + "CrossConnection-SiliconValley", "", "AzurePrivatePeering", "primary", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsListRoutesTableSummarySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsListRoutesTableSummarySamples.java new file mode 100644 index 0000000000000..3b54ed6ac652b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsListRoutesTableSummarySamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCrossConnections ListRoutesTableSummary. */ +public final class ExpressRouteCrossConnectionsListRoutesTableSummarySamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCrossConnectionsRouteTableSummary.json + */ + /** + * Sample code: GetExpressRouteCrossConnectionsRouteTableSummary. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getExpressRouteCrossConnectionsRouteTableSummary( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCrossConnections() + .listRoutesTableSummary( + "CrossConnection-SiliconValley", "", "AzurePrivatePeering", "primary", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsListSamples.java new file mode 100644 index 0000000000000..1e68f48fa76e8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteCrossConnections List. */ +public final class ExpressRouteCrossConnectionsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCrossConnectionList.json + */ + /** + * Sample code: ExpressRouteCrossConnectionList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRouteCrossConnectionList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getExpressRouteCrossConnections().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsUpdateTagsSamples.java new file mode 100644 index 0000000000000..1b01e60020a9f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteCrossConnectionsUpdateTagsSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ExpressRouteCrossConnections UpdateTags. */ +public final class ExpressRouteCrossConnectionsUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteCrossConnectionUpdateTags.json + */ + /** + * Sample code: UpdateExpressRouteCrossConnectionTags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateExpressRouteCrossConnectionTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteCrossConnections() + .updateTagsWithResponse( + "CrossConnection-SiliconValley", + "", + new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteGatewaysCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteGatewaysCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..fe17fd5289425 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteGatewaysCreateOrUpdateSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.ExpressRouteGatewayInner; +import com.azure.resourcemanager.network.models.ExpressRouteGatewayPropertiesAutoScaleConfiguration; +import com.azure.resourcemanager.network.models.ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds; +import com.azure.resourcemanager.network.models.VirtualHubId; + +/** Samples for ExpressRouteGateways CreateOrUpdate. */ +public final class ExpressRouteGatewaysCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteGatewayCreate.json + */ + /** + * Sample code: ExpressRouteGatewayCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRouteGatewayCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteGateways() + .createOrUpdate( + "resourceGroupName", + "gateway-2", + new ExpressRouteGatewayInner() + .withLocation("westus") + .withAutoScaleConfiguration( + new ExpressRouteGatewayPropertiesAutoScaleConfiguration() + .withBounds(new ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds().withMin(3))) + .withVirtualHub( + new VirtualHubId() + .withId( + "/subscriptions/subid/resourceGroups/resourceGroupId/providers/Microsoft.Network/virtualHubs/virtualHubName")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteGatewaysDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteGatewaysDeleteSamples.java new file mode 100644 index 0000000000000..5b2998f357c04 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteGatewaysDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteGateways Delete. */ +public final class ExpressRouteGatewaysDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteGatewayDelete.json + */ + /** + * Sample code: ExpressRouteGatewayDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRouteGatewayDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteGateways() + .delete("resourceGroupName", "expressRouteGatewayName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteGatewaysGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteGatewaysGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..30208e557b071 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteGatewaysGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteGateways GetByResourceGroup. */ +public final class ExpressRouteGatewaysGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteGatewayGet.json + */ + /** + * Sample code: ExpressRouteGatewayGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRouteGatewayGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteGateways() + .getByResourceGroupWithResponse("resourceGroupName", "expressRouteGatewayName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteGatewaysListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteGatewaysListByResourceGroupSamples.java new file mode 100644 index 0000000000000..63947c2f0d01e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteGatewaysListByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteGateways ListByResourceGroup. */ +public final class ExpressRouteGatewaysListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteGatewayListByResourceGroup.json + */ + /** + * Sample code: ExpressRouteGatewayListByResourceGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRouteGatewayListByResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteGateways() + .listByResourceGroupWithResponse("resourceGroupName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteGatewaysListBySubscriptionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteGatewaysListBySubscriptionSamples.java new file mode 100644 index 0000000000000..c4d258a9366b9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteGatewaysListBySubscriptionSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteGateways ListBySubscription. */ +public final class ExpressRouteGatewaysListBySubscriptionSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteGatewayListBySubscription.json + */ + /** + * Sample code: ExpressRouteGatewayListBySubscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRouteGatewayListBySubscription(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteGateways() + .listBySubscriptionWithResponse(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteGatewaysUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteGatewaysUpdateTagsSamples.java new file mode 100644 index 0000000000000..0c3d502089792 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteGatewaysUpdateTagsSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ExpressRouteGateways UpdateTags. */ +public final class ExpressRouteGatewaysUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteGatewayUpdateTags.json + */ + /** + * Sample code: ExpressRouteGatewayUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRouteGatewayUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteGateways() + .updateTags( + "resourceGroupName", + "expressRouteGatewayName", + new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteLinksGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteLinksGetSamples.java new file mode 100644 index 0000000000000..feecd54a72fd1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteLinksGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteLinks Get. */ +public final class ExpressRouteLinksGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteLinkGet.json + */ + /** + * Sample code: ExpressRouteLinkGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRouteLinkGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRouteLinks() + .getWithResponse("rg1", "portName", "linkName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteLinksListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteLinksListSamples.java new file mode 100644 index 0000000000000..0d4abf3b26e43 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteLinksListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteLinks List. */ +public final class ExpressRouteLinksListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteLinkList.json + */ + /** + * Sample code: ExpressRouteLinkGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRouteLinkGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getExpressRouteLinks().list("rg1", "portName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..0e78844c787db --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsCreateOrUpdateSamples.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.ExpressRouteLinkInner; +import com.azure.resourcemanager.network.fluent.models.ExpressRoutePortInner; +import com.azure.resourcemanager.network.models.ExpressRouteLinkAdminState; +import com.azure.resourcemanager.network.models.ExpressRoutePortsEncapsulation; +import java.util.Arrays; + +/** Samples for ExpressRoutePorts CreateOrUpdate. */ +public final class ExpressRoutePortsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRoutePortUpdateLink.json + */ + /** + * Sample code: ExpressRoutePortUpdateLink. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRoutePortUpdateLink(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRoutePorts() + .createOrUpdate( + "rg1", + "portName", + new ExpressRoutePortInner() + .withLocation("westus") + .withPeeringLocation("peeringLocationName") + .withBandwidthInGbps(100) + .withEncapsulation(ExpressRoutePortsEncapsulation.QINQ) + .withLinks( + Arrays + .asList( + new ExpressRouteLinkInner() + .withName("link1") + .withAdminState(ExpressRouteLinkAdminState.ENABLED))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRoutePortCreate.json + */ + /** + * Sample code: ExpressRoutePortCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRoutePortCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRoutePorts() + .createOrUpdate( + "rg1", + "portName", + new ExpressRoutePortInner() + .withLocation("westus") + .withPeeringLocation("peeringLocationName") + .withBandwidthInGbps(100) + .withEncapsulation(ExpressRoutePortsEncapsulation.QINQ), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsDeleteSamples.java new file mode 100644 index 0000000000000..a774bea5e6664 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRoutePorts Delete. */ +public final class ExpressRoutePortsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRoutePortDelete.json + */ + /** + * Sample code: ExpressRoutePortDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRoutePortDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getExpressRoutePorts().delete("rg1", "portName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsGenerateLoaSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsGenerateLoaSamples.java new file mode 100644 index 0000000000000..fc6c0a042970a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsGenerateLoaSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.GenerateExpressRoutePortsLoaRequest; + +/** Samples for ExpressRoutePorts GenerateLoa. */ +public final class ExpressRoutePortsGenerateLoaSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/GenerateExpressRoutePortsLOA.json + */ + /** + * Sample code: GenerateExpressRoutePortLOA. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void generateExpressRoutePortLOA(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRoutePorts() + .generateLoaWithResponse( + "rg1", + "portName", + new GenerateExpressRoutePortsLoaRequest().withCustomerName("customerName"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..303cef9f76de8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRoutePorts GetByResourceGroup. */ +public final class ExpressRoutePortsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRoutePortGet.json + */ + /** + * Sample code: ExpressRoutePortGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRoutePortGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRoutePorts() + .getByResourceGroupWithResponse("rg1", "portName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..fa046ea454686 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRoutePorts ListByResourceGroup. */ +public final class ExpressRoutePortsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRoutePortListByResourceGroup.json + */ + /** + * Sample code: ExpressRoutePortListByResourceGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRoutePortListByResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getExpressRoutePorts().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsListSamples.java new file mode 100644 index 0000000000000..e0841c3a1ad28 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRoutePorts List. */ +public final class ExpressRoutePortsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRoutePortList.json + */ + /** + * Sample code: ExpressRoutePortList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRoutePortList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getExpressRoutePorts().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsLocationsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsLocationsGetSamples.java new file mode 100644 index 0000000000000..f8ea92ec8bbdc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsLocationsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRoutePortsLocations Get. */ +public final class ExpressRoutePortsLocationsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRoutePortsLocationGet.json + */ + /** + * Sample code: ExpressRoutePortsLocationGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRoutePortsLocationGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRoutePortsLocations() + .getWithResponse("locationName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsLocationsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsLocationsListSamples.java new file mode 100644 index 0000000000000..20986e2c93e1d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsLocationsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRoutePortsLocations List. */ +public final class ExpressRoutePortsLocationsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRoutePortsLocationList.json + */ + /** + * Sample code: ExpressRoutePortsLocationList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRoutePortsLocationList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getExpressRoutePortsLocations().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsUpdateTagsSamples.java new file mode 100644 index 0000000000000..eb5a2e4f30d8a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRoutePortsUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ExpressRoutePorts UpdateTags. */ +public final class ExpressRoutePortsUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRoutePortUpdateTags.json + */ + /** + * Sample code: ExpressRoutePortUpdateTags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void expressRoutePortUpdateTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getExpressRoutePorts() + .updateTagsWithResponse( + "rg1", "portName", new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteServiceProvidersListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteServiceProvidersListSamples.java new file mode 100644 index 0000000000000..62cfd79ded960 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ExpressRouteServiceProvidersListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ExpressRouteServiceProviders List. */ +public final class ExpressRouteServiceProvidersListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ExpressRouteProviderList.json + */ + /** + * Sample code: List ExpressRoute providers. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listExpressRouteProviders(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getExpressRouteServiceProviders().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPoliciesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..b36c267a374a6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.FirewallPolicyInner; +import com.azure.resourcemanager.network.models.AzureFirewallThreatIntelMode; +import com.azure.resourcemanager.network.models.DnsSettings; +import com.azure.resourcemanager.network.models.ExplicitProxySettings; +import com.azure.resourcemanager.network.models.FirewallPolicyCertificateAuthority; +import com.azure.resourcemanager.network.models.FirewallPolicyInsights; +import com.azure.resourcemanager.network.models.FirewallPolicyIntrusionDetection; +import com.azure.resourcemanager.network.models.FirewallPolicyIntrusionDetectionBypassTrafficSpecifications; +import com.azure.resourcemanager.network.models.FirewallPolicyIntrusionDetectionConfiguration; +import com.azure.resourcemanager.network.models.FirewallPolicyIntrusionDetectionProtocol; +import com.azure.resourcemanager.network.models.FirewallPolicyIntrusionDetectionSignatureSpecification; +import com.azure.resourcemanager.network.models.FirewallPolicyIntrusionDetectionStateType; +import com.azure.resourcemanager.network.models.FirewallPolicyLogAnalyticsResources; +import com.azure.resourcemanager.network.models.FirewallPolicyLogAnalyticsWorkspace; +import com.azure.resourcemanager.network.models.FirewallPolicySku; +import com.azure.resourcemanager.network.models.FirewallPolicySkuTier; +import com.azure.resourcemanager.network.models.FirewallPolicySnat; +import com.azure.resourcemanager.network.models.FirewallPolicySql; +import com.azure.resourcemanager.network.models.FirewallPolicyThreatIntelWhitelist; +import com.azure.resourcemanager.network.models.FirewallPolicyTransportSecurity; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for FirewallPolicies CreateOrUpdate. */ +public final class FirewallPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicyPut.json + */ + /** + * Sample code: Create FirewallPolicy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createFirewallPolicy(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFirewallPolicies() + .createOrUpdate( + "rg1", + "firewallPolicy", + new FirewallPolicyInner() + .withLocation("West US") + .withTags(mapOf("key1", "value1")) + .withThreatIntelMode(AzureFirewallThreatIntelMode.ALERT) + .withThreatIntelWhitelist( + new FirewallPolicyThreatIntelWhitelist() + .withIpAddresses(Arrays.asList("20.3.4.5")) + .withFqdns(Arrays.asList("*.microsoft.com"))) + .withInsights( + new FirewallPolicyInsights() + .withIsEnabled(true) + .withRetentionDays(100) + .withLogAnalyticsResources( + new FirewallPolicyLogAnalyticsResources() + .withWorkspaces( + Arrays + .asList( + new FirewallPolicyLogAnalyticsWorkspace() + .withRegion("westus") + .withWorkspaceId( + new SubResource() + .withId( + "/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/workspace1")), + new FirewallPolicyLogAnalyticsWorkspace() + .withRegion("eastus") + .withWorkspaceId( + new SubResource() + .withId( + "/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/workspace2")))) + .withDefaultWorkspaceId( + new SubResource() + .withId( + "/subscriptions/subid/resourcegroups/rg1/providers/microsoft.operationalinsights/workspaces/defaultWorkspace")))) + .withSnat(new FirewallPolicySnat().withPrivateRanges(Arrays.asList("IANAPrivateRanges"))) + .withSql(new FirewallPolicySql().withAllowSqlRedirect(true)) + .withDnsSettings( + new DnsSettings() + .withServers(Arrays.asList("30.3.4.5")) + .withEnableProxy(true) + .withRequireProxyForNetworkRules(false)) + .withExplicitProxySettings( + new ExplicitProxySettings() + .withEnableExplicitProxy(true) + .withHttpPort(8087) + .withHttpsPort(8087) + .withPacFilePort(8087) + .withPacFile( + "https://tinawstorage.file.core.windows.net/?sv=2020-02-10&ss=bfqt&srt=sco&sp=rwdlacuptfx&se=2021-06-04T07:01:12Z&st=2021-06-03T23:01:12Z&sip=68.65.171.11&spr=https&sig=Plsa0RRVpGbY0IETZZOT6znOHcSro71LLTTbzquYPgs%3D")) + .withIntrusionDetection( + new FirewallPolicyIntrusionDetection() + .withMode(FirewallPolicyIntrusionDetectionStateType.ALERT) + .withConfiguration( + new FirewallPolicyIntrusionDetectionConfiguration() + .withSignatureOverrides( + Arrays + .asList( + new FirewallPolicyIntrusionDetectionSignatureSpecification() + .withId("2525004") + .withMode(FirewallPolicyIntrusionDetectionStateType.DENY))) + .withBypassTrafficSettings( + Arrays + .asList( + new FirewallPolicyIntrusionDetectionBypassTrafficSpecifications() + .withName("bypassRule1") + .withDescription("Rule 1") + .withProtocol(FirewallPolicyIntrusionDetectionProtocol.TCP) + .withSourceAddresses(Arrays.asList("1.2.3.4")) + .withDestinationAddresses(Arrays.asList("5.6.7.8")) + .withDestinationPorts(Arrays.asList("*")))))) + .withTransportSecurity( + new FirewallPolicyTransportSecurity() + .withCertificateAuthority( + new FirewallPolicyCertificateAuthority() + .withKeyVaultSecretId("https://kv/secret") + .withName("clientcert"))) + .withSku(new FirewallPolicySku().withTier(FirewallPolicySkuTier.PREMIUM)), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPoliciesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPoliciesDeleteSamples.java new file mode 100644 index 0000000000000..3108dd411267a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPoliciesDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for FirewallPolicies Delete. */ +public final class FirewallPoliciesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicyDelete.json + */ + /** + * Sample code: Delete Firewall Policy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteFirewallPolicy(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getFirewallPolicies().delete("rg1", "firewallPolicy", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPoliciesGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPoliciesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..244172d9f3fca --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPoliciesGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for FirewallPolicies GetByResourceGroup. */ +public final class FirewallPoliciesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicyGet.json + */ + /** + * Sample code: Get FirewallPolicy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getFirewallPolicy(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFirewallPolicies() + .getByResourceGroupWithResponse("rg1", "firewallPolicy", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPoliciesListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPoliciesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..7429c1353f47a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPoliciesListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for FirewallPolicies ListByResourceGroup. */ +public final class FirewallPoliciesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicyListByResourceGroup.json + */ + /** + * Sample code: List all Firewall Policies for a given resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllFirewallPoliciesForAGivenResourceGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getFirewallPolicies().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPoliciesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPoliciesListSamples.java new file mode 100644 index 0000000000000..2658eb02961df --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPoliciesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for FirewallPolicies List. */ +public final class FirewallPoliciesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicyListBySubscription.json + */ + /** + * Sample code: List all Firewall Policies for a given subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllFirewallPoliciesForAGivenSubscription( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getFirewallPolicies().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyIdpsSignaturesFilterValuesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyIdpsSignaturesFilterValuesListSamples.java new file mode 100644 index 0000000000000..6e90857f5fada --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyIdpsSignaturesFilterValuesListSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.SignatureOverridesFilterValuesQuery; + +/** Samples for FirewallPolicyIdpsSignaturesFilterValues List. */ +public final class FirewallPolicyIdpsSignaturesFilterValuesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicyQuerySignatureOverridesFilterValues.json + */ + /** + * Sample code: query signature overrides. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void querySignatureOverrides(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFirewallPolicyIdpsSignaturesFilterValues() + .listWithResponse( + "rg1", + "firewallPolicy", + new SignatureOverridesFilterValuesQuery().withFilterName("severity"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyIdpsSignaturesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyIdpsSignaturesListSamples.java new file mode 100644 index 0000000000000..42ac76dec505a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyIdpsSignaturesListSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.FilterItems; +import com.azure.resourcemanager.network.models.IdpsQueryObject; +import com.azure.resourcemanager.network.models.OrderBy; +import com.azure.resourcemanager.network.models.OrderByOrder; +import java.util.Arrays; + +/** Samples for FirewallPolicyIdpsSignatures List. */ +public final class FirewallPolicyIdpsSignaturesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicyQuerySignatureOverrides.json + */ + /** + * Sample code: query signature overrides. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void querySignatureOverrides(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFirewallPolicyIdpsSignatures() + .listWithResponse( + "rg1", + "firewallPolicy", + new IdpsQueryObject() + .withFilters(Arrays.asList(new FilterItems().withField("Mode").withValues(Arrays.asList("Deny")))) + .withSearch("") + .withOrderBy(new OrderBy().withField("severity").withOrder(OrderByOrder.ASCENDING)) + .withResultsPerPage(20) + .withSkip(0), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyIdpsSignaturesOverridesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyIdpsSignaturesOverridesGetSamples.java new file mode 100644 index 0000000000000..c4364d7482bef --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyIdpsSignaturesOverridesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for FirewallPolicyIdpsSignaturesOverrides Get. */ +public final class FirewallPolicyIdpsSignaturesOverridesGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicySignatureOverridesGet.json + */ + /** + * Sample code: get signature overrides. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getSignatureOverrides(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFirewallPolicyIdpsSignaturesOverrides() + .getWithResponse("rg1", "firewallPolicy", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyIdpsSignaturesOverridesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyIdpsSignaturesOverridesListSamples.java new file mode 100644 index 0000000000000..438dec122e453 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyIdpsSignaturesOverridesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for FirewallPolicyIdpsSignaturesOverrides List. */ +public final class FirewallPolicyIdpsSignaturesOverridesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicySignatureOverridesList.json + */ + /** + * Sample code: get signature overrides. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getSignatureOverrides(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFirewallPolicyIdpsSignaturesOverrides() + .listWithResponse("rg1", "firewallPolicy", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyIdpsSignaturesOverridesPatchSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyIdpsSignaturesOverridesPatchSamples.java new file mode 100644 index 0000000000000..7b237ddf1da20 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyIdpsSignaturesOverridesPatchSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.SignaturesOverridesInner; +import com.azure.resourcemanager.network.models.SignaturesOverridesProperties; +import java.util.HashMap; +import java.util.Map; + +/** Samples for FirewallPolicyIdpsSignaturesOverrides Patch. */ +public final class FirewallPolicyIdpsSignaturesOverridesPatchSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicySignatureOverridesPatch.json + */ + /** + * Sample code: patch signature overrides. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void patchSignatureOverrides(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFirewallPolicyIdpsSignaturesOverrides() + .patchWithResponse( + "rg1", + "firewallPolicy", + new SignaturesOverridesInner() + .withName("default") + .withId( + "/subscriptions/e747cc13-97d4-4a79-b463-42d7f4e558f2/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/signatureOverrides/default") + .withType("Microsoft.Network/firewallPolicies/signatureOverrides") + .withProperties( + new SignaturesOverridesProperties().withSignatures(mapOf("2000105", "Off", "2000106", "Deny"))), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyIdpsSignaturesOverridesPutSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyIdpsSignaturesOverridesPutSamples.java new file mode 100644 index 0000000000000..5568c9177a503 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyIdpsSignaturesOverridesPutSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.SignaturesOverridesInner; +import com.azure.resourcemanager.network.models.SignaturesOverridesProperties; +import java.util.HashMap; +import java.util.Map; + +/** Samples for FirewallPolicyIdpsSignaturesOverrides Put. */ +public final class FirewallPolicyIdpsSignaturesOverridesPutSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicySignatureOverridesPut.json + */ + /** + * Sample code: put signature overrides. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void putSignatureOverrides(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFirewallPolicyIdpsSignaturesOverrides() + .putWithResponse( + "rg1", + "firewallPolicy", + new SignaturesOverridesInner() + .withName("default") + .withId( + "/subscriptions/e747cc13-97d4-4a79-b463-42d7f4e558f2/resourceGroups/rg1/providers/Microsoft.Network/firewallPolicies/firewallPolicy/signatureOverrides/default") + .withType("Microsoft.Network/firewallPolicies/signatureOverrides") + .withProperties( + new SignaturesOverridesProperties().withSignatures(mapOf("2000105", "Off", "2000106", "Deny"))), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyRuleCollectionGroupsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyRuleCollectionGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..c4b820aa11599 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyRuleCollectionGroupsCreateOrUpdateSamples.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.FirewallPolicyRuleCollectionGroupInner; +import com.azure.resourcemanager.network.models.ApplicationRule; +import com.azure.resourcemanager.network.models.FirewallPolicyFilterRuleCollection; +import com.azure.resourcemanager.network.models.FirewallPolicyFilterRuleCollectionAction; +import com.azure.resourcemanager.network.models.FirewallPolicyFilterRuleCollectionActionType; +import com.azure.resourcemanager.network.models.FirewallPolicyNatRuleCollection; +import com.azure.resourcemanager.network.models.FirewallPolicyNatRuleCollectionAction; +import com.azure.resourcemanager.network.models.FirewallPolicyNatRuleCollectionActionType; +import com.azure.resourcemanager.network.models.FirewallPolicyRuleApplicationProtocol; +import com.azure.resourcemanager.network.models.FirewallPolicyRuleApplicationProtocolType; +import com.azure.resourcemanager.network.models.FirewallPolicyRuleNetworkProtocol; +import com.azure.resourcemanager.network.models.NatRule; +import com.azure.resourcemanager.network.models.NetworkRule; +import java.util.Arrays; + +/** Samples for FirewallPolicyRuleCollectionGroups CreateOrUpdate. */ +public final class FirewallPolicyRuleCollectionGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicyRuleCollectionGroupPut.json + */ + /** + * Sample code: Create FirewallPolicyRuleCollectionGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createFirewallPolicyRuleCollectionGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFirewallPolicyRuleCollectionGroups() + .createOrUpdate( + "rg1", + "firewallPolicy", + "ruleCollectionGroup1", + new FirewallPolicyRuleCollectionGroupInner() + .withPriority(100) + .withRuleCollections( + Arrays + .asList( + new FirewallPolicyFilterRuleCollection() + .withName("Example-Filter-Rule-Collection") + .withPriority(100) + .withAction( + new FirewallPolicyFilterRuleCollectionAction() + .withType(FirewallPolicyFilterRuleCollectionActionType.DENY)) + .withRules( + Arrays + .asList( + new NetworkRule() + .withName("network-rule1") + .withIpProtocols( + Arrays.asList(FirewallPolicyRuleNetworkProtocol.TCP)) + .withSourceAddresses(Arrays.asList("10.1.25.0/24")) + .withDestinationAddresses(Arrays.asList("*")) + .withDestinationPorts(Arrays.asList("*")))))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicyRuleCollectionGroupWithIpGroupsPut.json + */ + /** + * Sample code: Create FirewallPolicyRuleCollectionGroup With IpGroups. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createFirewallPolicyRuleCollectionGroupWithIpGroups( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFirewallPolicyRuleCollectionGroups() + .createOrUpdate( + "rg1", + "firewallPolicy", + "ruleCollectionGroup1", + new FirewallPolicyRuleCollectionGroupInner() + .withPriority(110) + .withRuleCollections( + Arrays + .asList( + new FirewallPolicyFilterRuleCollection() + .withName("Example-Filter-Rule-Collection") + .withAction( + new FirewallPolicyFilterRuleCollectionAction() + .withType(FirewallPolicyFilterRuleCollectionActionType.DENY)) + .withRules( + Arrays + .asList( + new NetworkRule() + .withName("network-1") + .withIpProtocols( + Arrays.asList(FirewallPolicyRuleNetworkProtocol.TCP)) + .withDestinationPorts(Arrays.asList("*")) + .withSourceIpGroups( + Arrays + .asList( + "/subscriptions/subid/providers/Microsoft.Network/resourceGroup/rg1/ipGroups/ipGroups1")) + .withDestinationIpGroups( + Arrays + .asList( + "/subscriptions/subid/providers/Microsoft.Network/resourceGroup/rg1/ipGroups/ipGroups2")))))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicyRuleCollectionGroupWithWebCategoriesPut.json + */ + /** + * Sample code: Create FirewallPolicyRuleCollectionGroup With Web Categories. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createFirewallPolicyRuleCollectionGroupWithWebCategories( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFirewallPolicyRuleCollectionGroups() + .createOrUpdate( + "rg1", + "firewallPolicy", + "ruleCollectionGroup1", + new FirewallPolicyRuleCollectionGroupInner() + .withPriority(110) + .withRuleCollections( + Arrays + .asList( + new FirewallPolicyFilterRuleCollection() + .withName("Example-Filter-Rule-Collection") + .withAction( + new FirewallPolicyFilterRuleCollectionAction() + .withType(FirewallPolicyFilterRuleCollectionActionType.DENY)) + .withRules( + Arrays + .asList( + new ApplicationRule() + .withName("rule1") + .withDescription("Deny inbound rule") + .withSourceAddresses(Arrays.asList("216.58.216.164", "10.0.0.0/24")) + .withProtocols( + Arrays + .asList( + new FirewallPolicyRuleApplicationProtocol() + .withProtocolType( + FirewallPolicyRuleApplicationProtocolType.HTTPS) + .withPort(443))) + .withWebCategories(Arrays.asList("Hacking")))))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicyNatRuleCollectionGroupPut.json + */ + /** + * Sample code: Create FirewallPolicyNatRuleCollectionGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createFirewallPolicyNatRuleCollectionGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFirewallPolicyRuleCollectionGroups() + .createOrUpdate( + "rg1", + "firewallPolicy", + "ruleCollectionGroup1", + new FirewallPolicyRuleCollectionGroupInner() + .withPriority(100) + .withRuleCollections( + Arrays + .asList( + new FirewallPolicyNatRuleCollection() + .withName("Example-Nat-Rule-Collection") + .withPriority(100) + .withAction( + new FirewallPolicyNatRuleCollectionAction() + .withType(FirewallPolicyNatRuleCollectionActionType.DNAT)) + .withRules( + Arrays + .asList( + new NatRule() + .withName("nat-rule1") + .withIpProtocols( + Arrays + .asList( + FirewallPolicyRuleNetworkProtocol.TCP, + FirewallPolicyRuleNetworkProtocol.UDP)) + .withSourceAddresses(Arrays.asList("2.2.2.2")) + .withDestinationAddresses(Arrays.asList("152.23.32.23")) + .withDestinationPorts(Arrays.asList("8080")) + .withTranslatedPort("8080") + .withSourceIpGroups(Arrays.asList()) + .withTranslatedFqdn("internalhttp.server.net"))))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyRuleCollectionGroupsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyRuleCollectionGroupsDeleteSamples.java new file mode 100644 index 0000000000000..9cad9a1d7f586 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyRuleCollectionGroupsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for FirewallPolicyRuleCollectionGroups Delete. */ +public final class FirewallPolicyRuleCollectionGroupsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicyRuleCollectionGroupDelete.json + */ + /** + * Sample code: Delete FirewallPolicyRuleCollectionGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteFirewallPolicyRuleCollectionGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFirewallPolicyRuleCollectionGroups() + .delete("rg1", "firewallPolicy", "ruleCollectionGroup1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyRuleCollectionGroupsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyRuleCollectionGroupsGetSamples.java new file mode 100644 index 0000000000000..5c7cdf1f03914 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyRuleCollectionGroupsGetSamples.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for FirewallPolicyRuleCollectionGroups Get. */ +public final class FirewallPolicyRuleCollectionGroupsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicyNatRuleCollectionGroupGet.json + */ + /** + * Sample code: Get FirewallPolicyNatRuleCollectionGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getFirewallPolicyNatRuleCollectionGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFirewallPolicyRuleCollectionGroups() + .getWithResponse("rg1", "firewallPolicy", "ruleCollectionGroup1", Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicyRuleCollectionGroupWithWebCategoriesGet.json + */ + /** + * Sample code: Get FirewallPolicyRuleCollectionGroup With Web Categories. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getFirewallPolicyRuleCollectionGroupWithWebCategories( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFirewallPolicyRuleCollectionGroups() + .getWithResponse("rg1", "firewallPolicy", "ruleCollectionGroup1", Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicyRuleCollectionGroupGet.json + */ + /** + * Sample code: Get FirewallPolicyRuleCollectionGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getFirewallPolicyRuleCollectionGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFirewallPolicyRuleCollectionGroups() + .getWithResponse("rg1", "firewallPolicy", "ruleCollectionGroup1", Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicyRuleCollectionGroupWithIpGroupsGet.json + */ + /** + * Sample code: Get FirewallPolicyRuleCollectionGroup With IpGroups. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getFirewallPolicyRuleCollectionGroupWithIpGroups( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFirewallPolicyRuleCollectionGroups() + .getWithResponse("rg1", "firewallPolicy", "ruleGroup1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyRuleCollectionGroupsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyRuleCollectionGroupsListSamples.java new file mode 100644 index 0000000000000..5760b350d44bd --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FirewallPolicyRuleCollectionGroupsListSamples.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for FirewallPolicyRuleCollectionGroups List. */ +public final class FirewallPolicyRuleCollectionGroupsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicyRuleCollectionGroupList.json + */ + /** + * Sample code: List all FirewallPolicyRuleCollectionGroups for a given FirewallPolicy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllFirewallPolicyRuleCollectionGroupsForAGivenFirewallPolicy( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFirewallPolicyRuleCollectionGroups() + .list("rg1", "firewallPolicy", Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicyRuleCollectionGroupWithIpGroupsList.json + */ + /** + * Sample code: List all FirewallPolicyRuleCollectionGroups with IpGroups for a given FirewallPolicy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllFirewallPolicyRuleCollectionGroupsWithIpGroupsForAGivenFirewallPolicy( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFirewallPolicyRuleCollectionGroups() + .list("rg1", "firewallPolicy", Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/FirewallPolicyRuleCollectionGroupWithWebCategoriesList.json + */ + /** + * Sample code: List all FirewallPolicyRuleCollectionGroup With Web Categories. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllFirewallPolicyRuleCollectionGroupWithWebCategories( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFirewallPolicyRuleCollectionGroups() + .list("rg1", "firewallPolicy", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FlowLogsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FlowLogsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..71d2a678e391b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FlowLogsCreateOrUpdateSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.FlowLogInner; +import com.azure.resourcemanager.network.models.FlowLogFormatParameters; +import com.azure.resourcemanager.network.models.FlowLogFormatType; + +/** Samples for FlowLogs CreateOrUpdate. */ +public final class FlowLogsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherFlowLogCreate.json + */ + /** + * Sample code: Create or update flow log. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateFlowLog(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFlowLogs() + .createOrUpdate( + "rg1", + "nw1", + "fl", + new FlowLogInner() + .withLocation("centraluseuap") + .withTargetResourceId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/desmondcentral-nsg") + .withStorageId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/nwtest1mgvbfmqsigdxe") + .withEnabled(true) + .withFormat(new FlowLogFormatParameters().withType(FlowLogFormatType.JSON).withVersion(1)), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FlowLogsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FlowLogsDeleteSamples.java new file mode 100644 index 0000000000000..bf8b59e16c0e9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FlowLogsDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for FlowLogs Delete. */ +public final class FlowLogsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherFlowLogDelete.json + */ + /** + * Sample code: Delete flow log. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteFlowLog(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getFlowLogs().delete("rg1", "nw1", "fl", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FlowLogsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FlowLogsGetSamples.java new file mode 100644 index 0000000000000..1b2229af1dce7 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FlowLogsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for FlowLogs Get. */ +public final class FlowLogsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherFlowLogGet.json + */ + /** + * Sample code: Get flow log. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getFlowLog(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFlowLogs() + .getWithResponse("rg1", "nw1", "flowLog1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FlowLogsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FlowLogsListSamples.java new file mode 100644 index 0000000000000..760b7391d4697 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FlowLogsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for FlowLogs List. */ +public final class FlowLogsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherFlowLogList.json + */ + /** + * Sample code: List connection monitors. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listConnectionMonitors(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getFlowLogs().list("rg1", "nw1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FlowLogsUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FlowLogsUpdateTagsSamples.java new file mode 100644 index 0000000000000..100caf03a15db --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/FlowLogsUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for FlowLogs UpdateTags. */ +public final class FlowLogsUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherFlowLogUpdateTags.json + */ + /** + * Sample code: Update flow log tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateFlowLogTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getFlowLogs() + .updateTagsWithResponse( + "rg1", "nw", "fl", new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubRouteTablesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubRouteTablesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..5fc235877f082 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubRouteTablesCreateOrUpdateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.HubRouteTableInner; +import com.azure.resourcemanager.network.models.HubRoute; +import java.util.Arrays; + +/** Samples for HubRouteTables CreateOrUpdate. */ +public final class HubRouteTablesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/HubRouteTablePut.json + */ + /** + * Sample code: RouteTablePut. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void routeTablePut(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getHubRouteTables() + .createOrUpdate( + "rg1", + "virtualHub1", + "hubRouteTable1", + new HubRouteTableInner() + .withRoutes( + Arrays + .asList( + new HubRoute() + .withName("route1") + .withDestinationType("CIDR") + .withDestinations(Arrays.asList("10.0.0.0/8", "20.0.0.0/8", "30.0.0.0/8")) + .withNextHopType("ResourceId") + .withNextHop( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azureFirewall1"))) + .withLabels(Arrays.asList("label1", "label2")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubRouteTablesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubRouteTablesDeleteSamples.java new file mode 100644 index 0000000000000..e9baf54c6781f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubRouteTablesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for HubRouteTables Delete. */ +public final class HubRouteTablesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/HubRouteTableDelete.json + */ + /** + * Sample code: RouteTableDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void routeTableDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getHubRouteTables() + .delete("rg1", "virtualHub1", "hubRouteTable1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubRouteTablesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubRouteTablesGetSamples.java new file mode 100644 index 0000000000000..266367d013c40 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubRouteTablesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for HubRouteTables Get. */ +public final class HubRouteTablesGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/HubRouteTableGet.json + */ + /** + * Sample code: RouteTableGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void routeTableGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getHubRouteTables() + .getWithResponse("rg1", "virtualHub1", "hubRouteTable1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubRouteTablesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubRouteTablesListSamples.java new file mode 100644 index 0000000000000..218b7c2dc9f6c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubRouteTablesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for HubRouteTables List. */ +public final class HubRouteTablesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/HubRouteTableList.json + */ + /** + * Sample code: RouteTableList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void routeTableList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getHubRouteTables().list("rg1", "virtualHub1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubVirtualNetworkConnectionsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubVirtualNetworkConnectionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..8a63a2c251701 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubVirtualNetworkConnectionsCreateOrUpdateSamples.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.HubVirtualNetworkConnectionInner; +import com.azure.resourcemanager.network.models.PropagatedRouteTable; +import com.azure.resourcemanager.network.models.RoutingConfiguration; +import com.azure.resourcemanager.network.models.StaticRoute; +import com.azure.resourcemanager.network.models.VnetRoute; +import java.util.Arrays; + +/** Samples for HubVirtualNetworkConnections CreateOrUpdate. */ +public final class HubVirtualNetworkConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/HubVirtualNetworkConnectionPut.json + */ + /** + * Sample code: HubVirtualNetworkConnectionPut. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void hubVirtualNetworkConnectionPut(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getHubVirtualNetworkConnections() + .createOrUpdate( + "rg1", + "virtualHub1", + "connection1", + new HubVirtualNetworkConnectionInner() + .withRemoteVirtualNetwork( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/SpokeVnet1")) + .withEnableInternetSecurity(false) + .withRoutingConfiguration( + new RoutingConfiguration() + .withAssociatedRouteTable( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1")) + .withPropagatedRouteTables( + new PropagatedRouteTable() + .withLabels(Arrays.asList("label1", "label2")) + .withIds( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1")))) + .withVnetRoutes( + new VnetRoute() + .withStaticRoutes( + Arrays + .asList( + new StaticRoute() + .withName("route1") + .withAddressPrefixes(Arrays.asList("10.1.0.0/16", "10.2.0.0/16")) + .withNextHopIpAddress("10.0.0.68"), + new StaticRoute() + .withName("route2") + .withAddressPrefixes(Arrays.asList("10.3.0.0/16", "10.4.0.0/16")) + .withNextHopIpAddress("10.0.0.65"))))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubVirtualNetworkConnectionsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubVirtualNetworkConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..519d9ec940dff --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubVirtualNetworkConnectionsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for HubVirtualNetworkConnections Delete. */ +public final class HubVirtualNetworkConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/HubVirtualNetworkConnectionDelete.json + */ + /** + * Sample code: HubVirtualNetworkConnectionDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void hubVirtualNetworkConnectionDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getHubVirtualNetworkConnections() + .delete("rg1", "virtualHub1", "connection1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubVirtualNetworkConnectionsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubVirtualNetworkConnectionsGetSamples.java new file mode 100644 index 0000000000000..75077b7334732 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubVirtualNetworkConnectionsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for HubVirtualNetworkConnections Get. */ +public final class HubVirtualNetworkConnectionsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/HubVirtualNetworkConnectionGet.json + */ + /** + * Sample code: HubVirtualNetworkConnectionGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void hubVirtualNetworkConnectionGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getHubVirtualNetworkConnections() + .getWithResponse("rg1", "virtualHub1", "connection1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubVirtualNetworkConnectionsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubVirtualNetworkConnectionsListSamples.java new file mode 100644 index 0000000000000..65c3184fbb07b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/HubVirtualNetworkConnectionsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for HubVirtualNetworkConnections List. */ +public final class HubVirtualNetworkConnectionsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/HubVirtualNetworkConnectionList.json + */ + /** + * Sample code: HubVirtualNetworkConnectionList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void hubVirtualNetworkConnectionList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getHubVirtualNetworkConnections() + .list("rg1", "virtualHub1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/InboundNatRulesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/InboundNatRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..2a9cb786efb14 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/InboundNatRulesCreateOrUpdateSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.InboundNatRuleInner; +import com.azure.resourcemanager.network.models.TransportProtocol; + +/** Samples for InboundNatRules CreateOrUpdate. */ +public final class InboundNatRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/InboundNatRuleCreate.json + */ + /** + * Sample code: InboundNatRuleCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void inboundNatRuleCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getInboundNatRules() + .createOrUpdate( + "testrg", + "lb1", + "natRule1.1", + new InboundNatRuleInner() + .withFrontendIpConfiguration( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb1/frontendIPConfigurations/ip1")) + .withProtocol(TransportProtocol.TCP) + .withFrontendPort(3390) + .withBackendPort(3389) + .withIdleTimeoutInMinutes(4) + .withEnableFloatingIp(false) + .withEnableTcpReset(false), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/InboundNatRulesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/InboundNatRulesDeleteSamples.java new file mode 100644 index 0000000000000..2af3dd063b8b5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/InboundNatRulesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for InboundNatRules Delete. */ +public final class InboundNatRulesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/InboundNatRuleDelete.json + */ + /** + * Sample code: InboundNatRuleDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void inboundNatRuleDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getInboundNatRules() + .delete("testrg", "lb1", "natRule1.1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/InboundNatRulesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/InboundNatRulesGetSamples.java new file mode 100644 index 0000000000000..e2d2191064786 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/InboundNatRulesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for InboundNatRules Get. */ +public final class InboundNatRulesGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/InboundNatRuleGet.json + */ + /** + * Sample code: InboundNatRuleGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void inboundNatRuleGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getInboundNatRules() + .getWithResponse("testrg", "lb1", "natRule1.1", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/InboundNatRulesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/InboundNatRulesListSamples.java new file mode 100644 index 0000000000000..0eccba08fb6f6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/InboundNatRulesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for InboundNatRules List. */ +public final class InboundNatRulesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/InboundNatRuleList.json + */ + /** + * Sample code: InboundNatRuleList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void inboundNatRuleList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getInboundNatRules().list("testrg", "lb1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/InboundSecurityRuleOperationCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/InboundSecurityRuleOperationCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e54a2cc65b756 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/InboundSecurityRuleOperationCreateOrUpdateSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.InboundSecurityRuleInner; +import com.azure.resourcemanager.network.models.InboundSecurityRules; +import com.azure.resourcemanager.network.models.InboundSecurityRulesProtocol; +import java.util.Arrays; + +/** Samples for InboundSecurityRuleOperation CreateOrUpdate. */ +public final class InboundSecurityRuleOperationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/InboundSecurityRulePut.json + */ + /** + * Sample code: Create Network Virtual Appliance Inbound Security Rules. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createNetworkVirtualApplianceInboundSecurityRules( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getInboundSecurityRuleOperations() + .createOrUpdate( + "rg1", + "nva", + "rule1", + new InboundSecurityRuleInner() + .withRules( + Arrays + .asList( + new InboundSecurityRules() + .withProtocol(InboundSecurityRulesProtocol.TCP) + .withSourceAddressPrefix("50.20.121.5/32") + .withDestinationPortRange(22))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpAllocationsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpAllocationsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..531d6c47ff172 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpAllocationsCreateOrUpdateSamples.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.IpAllocationInner; +import com.azure.resourcemanager.network.models.IpAllocationType; +import java.util.HashMap; +import java.util.Map; + +/** Samples for IpAllocations CreateOrUpdate. */ +public final class IpAllocationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/IpAllocationCreate.json + */ + /** + * Sample code: Create IpAllocation. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createIpAllocation(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getIpAllocations() + .createOrUpdate( + "rg1", + "test-ipallocation", + new IpAllocationInner() + .withLocation("centraluseuap") + .withTypePropertiesType(IpAllocationType.HYPERNET) + .withPrefix("3.2.5.0/24") + .withAllocationTags( + mapOf( + "VNetID", + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/HypernetVnet1")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpAllocationsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpAllocationsDeleteSamples.java new file mode 100644 index 0000000000000..0d07a97b05e61 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpAllocationsDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for IpAllocations Delete. */ +public final class IpAllocationsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/IpAllocationDelete.json + */ + /** + * Sample code: Delete IpAllocation. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteIpAllocation(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getIpAllocations().delete("rg1", "test-ipallocation", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpAllocationsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpAllocationsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..bb5a1ec8cf9b8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpAllocationsGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for IpAllocations GetByResourceGroup. */ +public final class IpAllocationsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/IpAllocationGet.json + */ + /** + * Sample code: Get IpAllocation. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getIpAllocation(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getIpAllocations() + .getByResourceGroupWithResponse("rg1", "test-ipallocation", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpAllocationsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpAllocationsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..2620a908f5727 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpAllocationsListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for IpAllocations ListByResourceGroup. */ +public final class IpAllocationsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/IpAllocationListByResourceGroup.json + */ + /** + * Sample code: List IpAllocations in resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listIpAllocationsInResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getIpAllocations().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpAllocationsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpAllocationsListSamples.java new file mode 100644 index 0000000000000..3d375c4b9f91e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpAllocationsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for IpAllocations List. */ +public final class IpAllocationsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/IpAllocationList.json + */ + /** + * Sample code: List all IpAllocations. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllIpAllocations(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getIpAllocations().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpAllocationsUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpAllocationsUpdateTagsSamples.java new file mode 100644 index 0000000000000..30fa6ae06f9f4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpAllocationsUpdateTagsSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for IpAllocations UpdateTags. */ +public final class IpAllocationsUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/IpAllocationUpdateTags.json + */ + /** + * Sample code: Update virtual network tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateVirtualNetworkTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getIpAllocations() + .updateTagsWithResponse( + "rg1", + "test-ipallocation", + new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpGroupsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..ec13a5d42de8a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpGroupsCreateOrUpdateSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.IpGroupInner; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for IpGroups CreateOrUpdate. */ +public final class IpGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/IpGroupsCreate.json + */ + /** + * Sample code: CreateOrUpdate_IpGroups. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateIpGroups(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getIpGroups() + .createOrUpdate( + "myResourceGroup", + "ipGroups1", + new IpGroupInner() + .withLocation("West US") + .withTags(mapOf("key1", "value1")) + .withIpAddresses(Arrays.asList("13.64.39.16/32", "40.74.146.80/31", "40.74.147.32/28")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpGroupsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpGroupsDeleteSamples.java new file mode 100644 index 0000000000000..68a573b662eda --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpGroupsDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for IpGroups Delete. */ +public final class IpGroupsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/IpGroupsDelete.json + */ + /** + * Sample code: Delete_IpGroups. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteIpGroups(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getIpGroups().delete("myResourceGroup", "ipGroups1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpGroupsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpGroupsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..0ebbc48ed55b5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpGroupsGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for IpGroups GetByResourceGroup. */ +public final class IpGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/IpGroupsGet.json + */ + /** + * Sample code: Get_IpGroups. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getIpGroups(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getIpGroups() + .getByResourceGroupWithResponse("myResourceGroup", "ipGroups1", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpGroupsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpGroupsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..0d3bf3394f504 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpGroupsListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for IpGroups ListByResourceGroup. */ +public final class IpGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/IpGroupsListByResourceGroup.json + */ + /** + * Sample code: ListByResourceGroup_IpGroups. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listByResourceGroupIpGroups(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getIpGroups().listByResourceGroup("myResourceGroup", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpGroupsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpGroupsListSamples.java new file mode 100644 index 0000000000000..16b1c1ddc8865 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpGroupsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for IpGroups List. */ +public final class IpGroupsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/IpGroupsListBySubscription.json + */ + /** + * Sample code: List_IpGroups. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listIpGroups(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getIpGroups().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpGroupsUpdateGroupsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpGroupsUpdateGroupsSamples.java new file mode 100644 index 0000000000000..a1f4cb81272eb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/IpGroupsUpdateGroupsSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for IpGroups UpdateGroups. */ +public final class IpGroupsUpdateGroupsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/IpGroupsUpdateTags.json + */ + /** + * Sample code: Update_IpGroups. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateIpGroups(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getIpGroups() + .updateGroupsWithResponse( + "myResourceGroup", + "ipGroups1", + new TagsObject().withTags(mapOf("key1", "value1", "key2", "value2")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerBackendAddressPoolsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerBackendAddressPoolsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..0cf8ae4b9d1e5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerBackendAddressPoolsCreateOrUpdateSamples.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.BackendAddressPoolInner; +import com.azure.resourcemanager.network.models.LoadBalancerBackendAddress; +import java.util.Arrays; + +/** Samples for LoadBalancerBackendAddressPools CreateOrUpdate. */ +public final class LoadBalancerBackendAddressPoolsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LBBackendAddressPoolWithBackendAddressesPut.json + */ + /** + * Sample code: Update load balancer backend pool with backend addresses containing virtual network and IP address. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateLoadBalancerBackendPoolWithBackendAddressesContainingVirtualNetworkAndIPAddress( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancerBackendAddressPools() + .createOrUpdate( + "testrg", + "lb", + "backend", + new BackendAddressPoolInner() + .withLoadBalancerBackendAddresses( + Arrays + .asList( + new LoadBalancerBackendAddress() + .withName("address1") + .withVirtualNetwork( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb")) + .withIpAddress("10.0.0.4"), + new LoadBalancerBackendAddress() + .withName("address2") + .withVirtualNetwork( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb")) + .withIpAddress("10.0.0.5"))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerBackendAddressPoolsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerBackendAddressPoolsDeleteSamples.java new file mode 100644 index 0000000000000..5ff61ab8e9699 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerBackendAddressPoolsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for LoadBalancerBackendAddressPools Delete. */ +public final class LoadBalancerBackendAddressPoolsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerBackendAddressPoolDelete.json + */ + /** + * Sample code: BackendAddressPoolDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void backendAddressPoolDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancerBackendAddressPools() + .delete("testrg", "lb", "backend", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerBackendAddressPoolsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerBackendAddressPoolsGetSamples.java new file mode 100644 index 0000000000000..c0a9c694d4a50 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerBackendAddressPoolsGetSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for LoadBalancerBackendAddressPools Get. */ +public final class LoadBalancerBackendAddressPoolsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerBackendAddressPoolGet.json + */ + /** + * Sample code: LoadBalancerBackendAddressPoolGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void loadBalancerBackendAddressPoolGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancerBackendAddressPools() + .getWithResponse("testrg", "lb", "backend", Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LBBackendAddressPoolWithBackendAddressesGet.json + */ + /** + * Sample code: LoadBalancer with BackendAddressPool with BackendAddresses. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void loadBalancerWithBackendAddressPoolWithBackendAddresses( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancerBackendAddressPools() + .getWithResponse("testrg", "lb", "backend", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerBackendAddressPoolsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerBackendAddressPoolsListSamples.java new file mode 100644 index 0000000000000..5bbc56df92768 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerBackendAddressPoolsListSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for LoadBalancerBackendAddressPools List. */ +public final class LoadBalancerBackendAddressPoolsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LBBackendAddressPoolListWithBackendAddressesPoolType.json + */ + /** + * Sample code: Load balancer with BackendAddressPool containing BackendAddresses. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void loadBalancerWithBackendAddressPoolContainingBackendAddresses( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancerBackendAddressPools() + .list("testrg", "lb", Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerBackendAddressPoolList.json + */ + /** + * Sample code: LoadBalancerBackendAddressPoolList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void loadBalancerBackendAddressPoolList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancerBackendAddressPools() + .list("testrg", "lb", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerFrontendIpConfigurationsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerFrontendIpConfigurationsGetSamples.java new file mode 100644 index 0000000000000..cdf7657a36e53 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerFrontendIpConfigurationsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for LoadBalancerFrontendIpConfigurations Get. */ +public final class LoadBalancerFrontendIpConfigurationsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerFrontendIPConfigurationGet.json + */ + /** + * Sample code: LoadBalancerFrontendIPConfigurationGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void loadBalancerFrontendIPConfigurationGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancerFrontendIpConfigurations() + .getWithResponse("testrg", "lb", "frontend", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerFrontendIpConfigurationsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerFrontendIpConfigurationsListSamples.java new file mode 100644 index 0000000000000..617263eda4c58 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerFrontendIpConfigurationsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for LoadBalancerFrontendIpConfigurations List. */ +public final class LoadBalancerFrontendIpConfigurationsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerFrontendIPConfigurationList.json + */ + /** + * Sample code: LoadBalancerFrontendIPConfigurationList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void loadBalancerFrontendIPConfigurationList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancerFrontendIpConfigurations() + .list("testrg", "lb", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerLoadBalancingRulesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerLoadBalancingRulesGetSamples.java new file mode 100644 index 0000000000000..0691f18dff407 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerLoadBalancingRulesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for LoadBalancerLoadBalancingRules Get. */ +public final class LoadBalancerLoadBalancingRulesGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerLoadBalancingRuleGet.json + */ + /** + * Sample code: LoadBalancerLoadBalancingRuleGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void loadBalancerLoadBalancingRuleGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancerLoadBalancingRules() + .getWithResponse("testrg", "lb1", "rule1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerLoadBalancingRulesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerLoadBalancingRulesListSamples.java new file mode 100644 index 0000000000000..3fa049be0970e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerLoadBalancingRulesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for LoadBalancerLoadBalancingRules List. */ +public final class LoadBalancerLoadBalancingRulesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerLoadBalancingRuleList.json + */ + /** + * Sample code: LoadBalancerLoadBalancingRuleList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void loadBalancerLoadBalancingRuleList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancerLoadBalancingRules() + .list("testrg", "lb1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerNetworkInterfacesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerNetworkInterfacesListSamples.java new file mode 100644 index 0000000000000..e11fe71453ea5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerNetworkInterfacesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for LoadBalancerNetworkInterfaces List. */ +public final class LoadBalancerNetworkInterfacesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerNetworkInterfaceListVmss.json + */ + /** + * Sample code: LoadBalancerNetworkInterfaceListVmss. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void loadBalancerNetworkInterfaceListVmss(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancerNetworkInterfaces() + .list("testrg", "lb", Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerNetworkInterfaceListSimple.json + */ + /** + * Sample code: LoadBalancerNetworkInterfaceListSimple. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void loadBalancerNetworkInterfaceListSimple(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancerNetworkInterfaces() + .list("testrg", "lb", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerOutboundRulesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerOutboundRulesGetSamples.java new file mode 100644 index 0000000000000..9fac09392d4bd --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerOutboundRulesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for LoadBalancerOutboundRules Get. */ +public final class LoadBalancerOutboundRulesGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerOutboundRuleGet.json + */ + /** + * Sample code: LoadBalancerOutboundRuleGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void loadBalancerOutboundRuleGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancerOutboundRules() + .getWithResponse("testrg", "lb1", "rule1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerOutboundRulesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerOutboundRulesListSamples.java new file mode 100644 index 0000000000000..c737bd497bb16 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerOutboundRulesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for LoadBalancerOutboundRules List. */ +public final class LoadBalancerOutboundRulesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerOutboundRuleList.json + */ + /** + * Sample code: LoadBalancerOutboundRuleList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void loadBalancerOutboundRuleList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getLoadBalancerOutboundRules().list("testrg", "lb1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerProbesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerProbesGetSamples.java new file mode 100644 index 0000000000000..b731d525fd987 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerProbesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for LoadBalancerProbes Get. */ +public final class LoadBalancerProbesGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerProbeGet.json + */ + /** + * Sample code: LoadBalancerProbeGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void loadBalancerProbeGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancerProbes() + .getWithResponse("testrg", "lb", "probe1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerProbesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerProbesListSamples.java new file mode 100644 index 0000000000000..fa3a51a683834 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancerProbesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for LoadBalancerProbes List. */ +public final class LoadBalancerProbesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerProbeList.json + */ + /** + * Sample code: LoadBalancerProbeList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void loadBalancerProbeList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getLoadBalancerProbes().list("testrg", "lb", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..0c3bc53901bb0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersCreateOrUpdateSamples.java @@ -0,0 +1,775 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.BackendAddressPoolInner; +import com.azure.resourcemanager.network.fluent.models.FrontendIpConfigurationInner; +import com.azure.resourcemanager.network.fluent.models.InboundNatRuleInner; +import com.azure.resourcemanager.network.fluent.models.LoadBalancerInner; +import com.azure.resourcemanager.network.fluent.models.LoadBalancingRuleInner; +import com.azure.resourcemanager.network.fluent.models.OutboundRuleInner; +import com.azure.resourcemanager.network.fluent.models.ProbeInner; +import com.azure.resourcemanager.network.fluent.models.PublicIpAddressInner; +import com.azure.resourcemanager.network.fluent.models.SubnetInner; +import com.azure.resourcemanager.network.models.GatewayLoadBalancerTunnelInterface; +import com.azure.resourcemanager.network.models.GatewayLoadBalancerTunnelInterfaceType; +import com.azure.resourcemanager.network.models.GatewayLoadBalancerTunnelProtocol; +import com.azure.resourcemanager.network.models.InboundNatPool; +import com.azure.resourcemanager.network.models.IpAllocationMethod; +import com.azure.resourcemanager.network.models.LoadBalancerBackendAddress; +import com.azure.resourcemanager.network.models.LoadBalancerOutboundRuleProtocol; +import com.azure.resourcemanager.network.models.LoadBalancerSku; +import com.azure.resourcemanager.network.models.LoadBalancerSkuName; +import com.azure.resourcemanager.network.models.LoadBalancerSkuTier; +import com.azure.resourcemanager.network.models.LoadDistribution; +import com.azure.resourcemanager.network.models.ProbeProtocol; +import com.azure.resourcemanager.network.models.TransportProtocol; +import java.util.Arrays; + +/** Samples for LoadBalancers CreateOrUpdate. */ +public final class LoadBalancersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerCreateGatewayLoadBalancerProviderWithTwoBackendPool.json + */ + /** + * Sample code: Create load balancer with Gateway Load Balancer Provider configured with two Backend Pool. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createLoadBalancerWithGatewayLoadBalancerProviderConfiguredWithTwoBackendPool( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancers() + .createOrUpdate( + "rg1", + "lb", + new LoadBalancerInner() + .withLocation("eastus") + .withSku(new LoadBalancerSku().withName(LoadBalancerSkuName.fromString("Premium"))) + .withFrontendIpConfigurations( + Arrays + .asList( + new FrontendIpConfigurationInner() + .withName("fe-lb") + .withSubnet( + new SubnetInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb")))) + .withBackendAddressPools( + Arrays + .asList( + new BackendAddressPoolInner().withName("be-lb1"), + new BackendAddressPoolInner().withName("be-lb2"))) + .withLoadBalancingRules( + Arrays + .asList( + new LoadBalancingRuleInner() + .withName("rulelb") + .withFrontendIpConfiguration( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb")) + .withBackendAddressPool(new SubResource()) + .withBackendAddressPools( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb1"), + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb2"))) + .withProbe( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb")) + .withProtocol(TransportProtocol.ALL) + .withLoadDistribution(LoadDistribution.DEFAULT) + .withFrontendPort(0) + .withBackendPort(0) + .withIdleTimeoutInMinutes(15) + .withEnableFloatingIp(true))) + .withProbes( + Arrays + .asList( + new ProbeInner() + .withName("probe-lb") + .withProtocol(ProbeProtocol.HTTP) + .withPort(80) + .withIntervalInSeconds(15) + .withNumberOfProbes(2) + .withRequestPath("healthcheck.aspx"))) + .withInboundNatPools(Arrays.asList()) + .withOutboundRules(Arrays.asList()), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerCreateWithInboundNatPool.json + */ + /** + * Sample code: Create load balancer with inbound nat pool. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createLoadBalancerWithInboundNatPool(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancers() + .createOrUpdate( + "rg1", + "lb", + new LoadBalancerInner() + .withLocation("eastus") + .withSku(new LoadBalancerSku().withName(LoadBalancerSkuName.STANDARD)) + .withFrontendIpConfigurations( + Arrays + .asList( + new FrontendIpConfigurationInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test") + .withName("test") + .withZones(Arrays.asList()) + .withPrivateIpAllocationMethod(IpAllocationMethod.DYNAMIC) + .withSubnet( + new SubnetInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/lbvnet/subnets/lbsubnet")))) + .withBackendAddressPools(Arrays.asList()) + .withLoadBalancingRules(Arrays.asList()) + .withProbes(Arrays.asList()) + .withInboundNatRules(Arrays.asList()) + .withInboundNatPools( + Arrays + .asList( + new InboundNatPool() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/inboundNatPools/test") + .withName("test") + .withFrontendIpConfiguration( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/test")) + .withProtocol(TransportProtocol.TCP) + .withFrontendPortRangeStart(8080) + .withFrontendPortRangeEnd(8085) + .withBackendPort(8888) + .withIdleTimeoutInMinutes(10) + .withEnableFloatingIp(true) + .withEnableTcpReset(true))) + .withOutboundRules(Arrays.asList()), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerCreateWithZones.json + */ + /** + * Sample code: Create load balancer with Frontend IP in Zone 1. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createLoadBalancerWithFrontendIPInZone1(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancers() + .createOrUpdate( + "rg1", + "lb", + new LoadBalancerInner() + .withLocation("eastus") + .withSku(new LoadBalancerSku().withName(LoadBalancerSkuName.STANDARD)) + .withFrontendIpConfigurations( + Arrays + .asList( + new FrontendIpConfigurationInner() + .withName("fe-lb") + .withZones(Arrays.asList("1")) + .withSubnet( + new SubnetInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb")))) + .withBackendAddressPools(Arrays.asList(new BackendAddressPoolInner().withName("be-lb"))) + .withLoadBalancingRules( + Arrays + .asList( + new LoadBalancingRuleInner() + .withName("rulelb") + .withFrontendIpConfiguration( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb")) + .withBackendAddressPool( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb")) + .withProbe( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb")) + .withProtocol(TransportProtocol.TCP) + .withLoadDistribution(LoadDistribution.DEFAULT) + .withFrontendPort(80) + .withBackendPort(80) + .withIdleTimeoutInMinutes(15) + .withEnableFloatingIp(true))) + .withProbes( + Arrays + .asList( + new ProbeInner() + .withName("probe-lb") + .withProtocol(ProbeProtocol.HTTP) + .withPort(80) + .withIntervalInSeconds(15) + .withNumberOfProbes(2) + .withRequestPath("healthcheck.aspx"))) + .withInboundNatRules( + Arrays + .asList( + new InboundNatRuleInner() + .withName("in-nat-rule") + .withFrontendIpConfiguration( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb")) + .withProtocol(TransportProtocol.TCP) + .withFrontendPort(3389) + .withBackendPort(3389) + .withIdleTimeoutInMinutes(15) + .withEnableFloatingIp(true))) + .withInboundNatPools(Arrays.asList()) + .withOutboundRules(Arrays.asList()), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerCreateWithOutboundRules.json + */ + /** + * Sample code: Create load balancer with outbound rules. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createLoadBalancerWithOutboundRules(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancers() + .createOrUpdate( + "rg1", + "lb", + new LoadBalancerInner() + .withLocation("eastus") + .withSku(new LoadBalancerSku().withName(LoadBalancerSkuName.STANDARD)) + .withFrontendIpConfigurations( + Arrays + .asList( + new FrontendIpConfigurationInner() + .withName("fe-lb") + .withPublicIpAddress( + new PublicIpAddressInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pip")))) + .withBackendAddressPools(Arrays.asList(new BackendAddressPoolInner().withName("be-lb"))) + .withLoadBalancingRules( + Arrays + .asList( + new LoadBalancingRuleInner() + .withName("rulelb") + .withFrontendIpConfiguration( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb")) + .withBackendAddressPool( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb")) + .withProbe( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb")) + .withProtocol(TransportProtocol.TCP) + .withLoadDistribution(LoadDistribution.DEFAULT) + .withFrontendPort(80) + .withBackendPort(80) + .withIdleTimeoutInMinutes(15) + .withEnableFloatingIp(true) + .withDisableOutboundSnat(true))) + .withProbes( + Arrays + .asList( + new ProbeInner() + .withName("probe-lb") + .withProtocol(ProbeProtocol.HTTP) + .withPort(80) + .withIntervalInSeconds(15) + .withNumberOfProbes(2) + .withRequestPath("healthcheck.aspx"))) + .withInboundNatRules( + Arrays + .asList( + new InboundNatRuleInner() + .withName("in-nat-rule") + .withFrontendIpConfiguration( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb")) + .withProtocol(TransportProtocol.TCP) + .withFrontendPort(3389) + .withBackendPort(3389) + .withIdleTimeoutInMinutes(15) + .withEnableFloatingIp(true))) + .withInboundNatPools(Arrays.asList()) + .withOutboundRules( + Arrays + .asList( + new OutboundRuleInner() + .withName("rule1") + .withFrontendIpConfigurations( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"))) + .withBackendAddressPool( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb")) + .withProtocol(LoadBalancerOutboundRuleProtocol.ALL))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerCreateGatewayLoadBalancerProviderWithOneBackendPool.json + */ + /** + * Sample code: Create load balancer with Gateway Load Balancer Provider configured with one Backend Pool. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createLoadBalancerWithGatewayLoadBalancerProviderConfiguredWithOneBackendPool( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancers() + .createOrUpdate( + "rg1", + "lb", + new LoadBalancerInner() + .withLocation("eastus") + .withSku(new LoadBalancerSku().withName(LoadBalancerSkuName.fromString("Premium"))) + .withFrontendIpConfigurations( + Arrays + .asList( + new FrontendIpConfigurationInner() + .withName("fe-lb") + .withSubnet( + new SubnetInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb")))) + .withBackendAddressPools( + Arrays + .asList( + new BackendAddressPoolInner() + .withName("be-lb") + .withTunnelInterfaces( + Arrays + .asList( + new GatewayLoadBalancerTunnelInterface() + .withPort(15000) + .withIdentifier(900) + .withProtocol(GatewayLoadBalancerTunnelProtocol.VXLAN) + .withType(GatewayLoadBalancerTunnelInterfaceType.INTERNAL), + new GatewayLoadBalancerTunnelInterface() + .withPort(15001) + .withIdentifier(901) + .withProtocol(GatewayLoadBalancerTunnelProtocol.VXLAN) + .withType(GatewayLoadBalancerTunnelInterfaceType.INTERNAL))))) + .withLoadBalancingRules( + Arrays + .asList( + new LoadBalancingRuleInner() + .withName("rulelb") + .withFrontendIpConfiguration( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb")) + .withBackendAddressPools( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb"))) + .withProbe( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb")) + .withProtocol(TransportProtocol.ALL) + .withLoadDistribution(LoadDistribution.DEFAULT) + .withFrontendPort(0) + .withBackendPort(0) + .withIdleTimeoutInMinutes(15) + .withEnableFloatingIp(true))) + .withProbes( + Arrays + .asList( + new ProbeInner() + .withName("probe-lb") + .withProtocol(ProbeProtocol.HTTP) + .withPort(80) + .withIntervalInSeconds(15) + .withNumberOfProbes(2) + .withRequestPath("healthcheck.aspx"))) + .withInboundNatPools(Arrays.asList()) + .withOutboundRules(Arrays.asList()), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerCreate.json + */ + /** + * Sample code: Create load balancer. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createLoadBalancer(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancers() + .createOrUpdate( + "rg1", + "lb", + new LoadBalancerInner() + .withLocation("eastus") + .withFrontendIpConfigurations( + Arrays + .asList( + new FrontendIpConfigurationInner() + .withName("fe-lb") + .withSubnet( + new SubnetInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb")))) + .withBackendAddressPools(Arrays.asList(new BackendAddressPoolInner().withName("be-lb"))) + .withLoadBalancingRules( + Arrays + .asList( + new LoadBalancingRuleInner() + .withName("rulelb") + .withFrontendIpConfiguration( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb")) + .withBackendAddressPool( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb")) + .withProbe( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb")) + .withProtocol(TransportProtocol.TCP) + .withLoadDistribution(LoadDistribution.DEFAULT) + .withFrontendPort(80) + .withBackendPort(80) + .withIdleTimeoutInMinutes(15) + .withEnableFloatingIp(true) + .withEnableTcpReset(false))) + .withProbes( + Arrays + .asList( + new ProbeInner() + .withName("probe-lb") + .withProtocol(ProbeProtocol.HTTP) + .withPort(80) + .withIntervalInSeconds(15) + .withNumberOfProbes(2) + .withRequestPath("healthcheck.aspx"))) + .withInboundNatRules( + Arrays + .asList( + new InboundNatRuleInner() + .withName("in-nat-rule") + .withFrontendIpConfiguration( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb")) + .withProtocol(TransportProtocol.TCP) + .withFrontendPort(3389) + .withBackendPort(3389) + .withIdleTimeoutInMinutes(15) + .withEnableFloatingIp(true) + .withEnableTcpReset(false))) + .withInboundNatPools(Arrays.asList()), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerCreateGlobalTier.json + */ + /** + * Sample code: Create load balancer with Global Tier and one regional load balancer in its backend pool. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createLoadBalancerWithGlobalTierAndOneRegionalLoadBalancerInItsBackendPool( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancers() + .createOrUpdate( + "rg1", + "lb", + new LoadBalancerInner() + .withLocation("eastus") + .withSku( + new LoadBalancerSku() + .withName(LoadBalancerSkuName.STANDARD) + .withTier(LoadBalancerSkuTier.GLOBAL)) + .withFrontendIpConfigurations( + Arrays + .asList( + new FrontendIpConfigurationInner() + .withName("fe-lb") + .withSubnet( + new SubnetInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb")))) + .withBackendAddressPools( + Arrays + .asList( + new BackendAddressPoolInner() + .withName("be-lb") + .withLoadBalancerBackendAddresses( + Arrays + .asList( + new LoadBalancerBackendAddress() + .withName("regional-lb1-address") + .withLoadBalancerFrontendIpConfiguration( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/regional-lb-rg1/providers/Microsoft.Network/loadBalancers/regional-lb/frontendIPConfigurations/fe-rlb")))))) + .withLoadBalancingRules( + Arrays + .asList( + new LoadBalancingRuleInner() + .withName("rulelb") + .withFrontendIpConfiguration( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb")) + .withBackendAddressPool( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb")) + .withProbe( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb")) + .withProtocol(TransportProtocol.TCP) + .withLoadDistribution(LoadDistribution.DEFAULT) + .withFrontendPort(80) + .withBackendPort(80) + .withIdleTimeoutInMinutes(15) + .withEnableFloatingIp(false))) + .withProbes( + Arrays + .asList( + new ProbeInner() + .withName("probe-lb") + .withProtocol(ProbeProtocol.HTTP) + .withPort(80) + .withIntervalInSeconds(15) + .withNumberOfProbes(2) + .withRequestPath("healthcheck.aspx"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerCreateGatewayLoadBalancerConsumer.json + */ + /** + * Sample code: Create load balancer with Gateway Load Balancer Consumer configured. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createLoadBalancerWithGatewayLoadBalancerConsumerConfigured( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancers() + .createOrUpdate( + "rg1", + "lb", + new LoadBalancerInner() + .withLocation("eastus") + .withSku(new LoadBalancerSku().withName(LoadBalancerSkuName.STANDARD)) + .withFrontendIpConfigurations( + Arrays + .asList( + new FrontendIpConfigurationInner() + .withName("fe-lb") + .withSubnet( + new SubnetInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb")) + .withGatewayLoadBalancer( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb-provider")))) + .withBackendAddressPools(Arrays.asList(new BackendAddressPoolInner().withName("be-lb"))) + .withLoadBalancingRules( + Arrays + .asList( + new LoadBalancingRuleInner() + .withName("rulelb") + .withFrontendIpConfiguration( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb")) + .withBackendAddressPool( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb")) + .withProbe( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb")) + .withProtocol(TransportProtocol.TCP) + .withLoadDistribution(LoadDistribution.DEFAULT) + .withFrontendPort(80) + .withBackendPort(80) + .withIdleTimeoutInMinutes(15) + .withEnableFloatingIp(true))) + .withProbes( + Arrays + .asList( + new ProbeInner() + .withName("probe-lb") + .withProtocol(ProbeProtocol.HTTP) + .withPort(80) + .withIntervalInSeconds(15) + .withNumberOfProbes(2) + .withRequestPath("healthcheck.aspx"))) + .withInboundNatRules( + Arrays + .asList( + new InboundNatRuleInner() + .withName("in-nat-rule") + .withFrontendIpConfiguration( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb")) + .withProtocol(TransportProtocol.TCP) + .withFrontendPort(3389) + .withBackendPort(3389) + .withIdleTimeoutInMinutes(15) + .withEnableFloatingIp(true))) + .withInboundNatPools(Arrays.asList()) + .withOutboundRules(Arrays.asList()), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerCreateStandardSku.json + */ + /** + * Sample code: Create load balancer with Standard SKU. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createLoadBalancerWithStandardSKU(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancers() + .createOrUpdate( + "rg1", + "lb", + new LoadBalancerInner() + .withLocation("eastus") + .withSku(new LoadBalancerSku().withName(LoadBalancerSkuName.STANDARD)) + .withFrontendIpConfigurations( + Arrays + .asList( + new FrontendIpConfigurationInner() + .withName("fe-lb") + .withSubnet( + new SubnetInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb")))) + .withBackendAddressPools(Arrays.asList(new BackendAddressPoolInner().withName("be-lb"))) + .withLoadBalancingRules( + Arrays + .asList( + new LoadBalancingRuleInner() + .withName("rulelb") + .withFrontendIpConfiguration( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb")) + .withBackendAddressPool( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb")) + .withProbe( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb")) + .withProtocol(TransportProtocol.TCP) + .withLoadDistribution(LoadDistribution.DEFAULT) + .withFrontendPort(80) + .withBackendPort(80) + .withIdleTimeoutInMinutes(15) + .withEnableFloatingIp(true))) + .withProbes( + Arrays + .asList( + new ProbeInner() + .withName("probe-lb") + .withProtocol(ProbeProtocol.HTTP) + .withPort(80) + .withIntervalInSeconds(15) + .withNumberOfProbes(2) + .withRequestPath("healthcheck.aspx"))) + .withInboundNatRules( + Arrays + .asList( + new InboundNatRuleInner() + .withName("in-nat-rule") + .withFrontendIpConfiguration( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb")) + .withProtocol(TransportProtocol.TCP) + .withFrontendPort(3389) + .withBackendPort(3389) + .withIdleTimeoutInMinutes(15) + .withEnableFloatingIp(true))) + .withInboundNatPools(Arrays.asList()) + .withOutboundRules(Arrays.asList()), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersDeleteSamples.java new file mode 100644 index 0000000000000..01eca881761e2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for LoadBalancers Delete. */ +public final class LoadBalancersDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerDelete.json + */ + /** + * Sample code: Delete load balancer. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteLoadBalancer(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getLoadBalancers().delete("rg1", "lb", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..f2e6cecf4b894 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersGetByResourceGroupSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for LoadBalancers GetByResourceGroup. */ +public final class LoadBalancersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerGet.json + */ + /** + * Sample code: Get load balancer. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getLoadBalancer(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancers() + .getByResourceGroupWithResponse("rg1", "lb", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerGetInboundNatRulePortMapping.json + */ + /** + * Sample code: Get load balancer with inbound NAT rule port mapping. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getLoadBalancerWithInboundNATRulePortMapping( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancers() + .getByResourceGroupWithResponse("rg1", "lb", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersListByResourceGroupSamples.java new file mode 100644 index 0000000000000..3823e64b29ee9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for LoadBalancers ListByResourceGroup. */ +public final class LoadBalancersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerList.json + */ + /** + * Sample code: List load balancers in resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listLoadBalancersInResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getLoadBalancers().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersListInboundNatRulePortMappingsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersListInboundNatRulePortMappingsSamples.java new file mode 100644 index 0000000000000..947aeb1eceaa0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersListInboundNatRulePortMappingsSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.QueryInboundNatRulePortMappingRequest; + +/** Samples for LoadBalancers ListInboundNatRulePortMappings. */ +public final class LoadBalancersListInboundNatRulePortMappingsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/QueryInboundNatRulePortMapping.json + */ + /** + * Sample code: Query inbound NAT rule port mapping. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void queryInboundNATRulePortMapping(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancers() + .listInboundNatRulePortMappings( + "rg1", + "lb1", + "bp1", + new QueryInboundNatRulePortMappingRequest().withIpAddress("10.0.0.4"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersListSamples.java new file mode 100644 index 0000000000000..c1a34c41d4b91 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for LoadBalancers List. */ +public final class LoadBalancersListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerListAll.json + */ + /** + * Sample code: List all load balancers. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllLoadBalancers(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getLoadBalancers().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersSwapPublicIpAddressesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersSwapPublicIpAddressesSamples.java new file mode 100644 index 0000000000000..b50f4952ec1f3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersSwapPublicIpAddressesSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.LoadBalancerVipSwapRequest; +import com.azure.resourcemanager.network.models.LoadBalancerVipSwapRequestFrontendIpConfiguration; +import java.util.Arrays; + +/** Samples for LoadBalancers SwapPublicIpAddresses. */ +public final class LoadBalancersSwapPublicIpAddressesSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancersSwapPublicIpAddresses.json + */ + /** + * Sample code: Swap VIPs between two load balancers. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void swapVIPsBetweenTwoLoadBalancers(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancers() + .swapPublicIpAddresses( + "westus", + new LoadBalancerVipSwapRequest() + .withFrontendIpConfigurations( + Arrays + .asList( + new LoadBalancerVipSwapRequestFrontendIpConfiguration() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/frontendIPConfigurations/lbfe1") + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/publicIPAddresses/pip2")), + new LoadBalancerVipSwapRequestFrontendIpConfiguration() + .withId( + "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/loadBalancers/lb2/frontendIPConfigurations/lbfe2") + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pip1")))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersUpdateTagsSamples.java new file mode 100644 index 0000000000000..c89fbcbae8c2c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LoadBalancersUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for LoadBalancers UpdateTags. */ +public final class LoadBalancersUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LoadBalancerUpdateTags.json + */ + /** + * Sample code: Update load balancer tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateLoadBalancerTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLoadBalancers() + .updateTagsWithResponse( + "rg1", "lb", new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LocalNetworkGatewaysCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LocalNetworkGatewaysCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..d7b13ebcbdacb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LocalNetworkGatewaysCreateOrUpdateSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.LocalNetworkGatewayInner; +import com.azure.resourcemanager.network.models.AddressSpace; +import java.util.Arrays; + +/** Samples for LocalNetworkGateways CreateOrUpdate. */ +public final class LocalNetworkGatewaysCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LocalNetworkGatewayCreate.json + */ + /** + * Sample code: CreateLocalNetworkGateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createLocalNetworkGateway(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLocalNetworkGateways() + .createOrUpdate( + "rg1", + "localgw", + new LocalNetworkGatewayInner() + .withLocation("Central US") + .withLocalNetworkAddressSpace(new AddressSpace().withAddressPrefixes(Arrays.asList("10.1.0.0/16"))) + .withGatewayIpAddress("11.12.13.14") + .withFqdn("site1.contoso.com"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LocalNetworkGatewaysDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LocalNetworkGatewaysDeleteSamples.java new file mode 100644 index 0000000000000..9ae7c37ca483d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LocalNetworkGatewaysDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for LocalNetworkGateways Delete. */ +public final class LocalNetworkGatewaysDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LocalNetworkGatewayDelete.json + */ + /** + * Sample code: DeleteLocalNetworkGateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteLocalNetworkGateway(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getLocalNetworkGateways().delete("rg1", "localgw", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LocalNetworkGatewaysGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LocalNetworkGatewaysGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..360b37ecdfcc9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LocalNetworkGatewaysGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for LocalNetworkGateways GetByResourceGroup. */ +public final class LocalNetworkGatewaysGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LocalNetworkGatewayGet.json + */ + /** + * Sample code: GetLocalNetworkGateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getLocalNetworkGateway(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLocalNetworkGateways() + .getByResourceGroupWithResponse("rg1", "localgw", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LocalNetworkGatewaysListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LocalNetworkGatewaysListByResourceGroupSamples.java new file mode 100644 index 0000000000000..a84d0c1570848 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LocalNetworkGatewaysListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for LocalNetworkGateways ListByResourceGroup. */ +public final class LocalNetworkGatewaysListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LocalNetworkGatewayList.json + */ + /** + * Sample code: ListLocalNetworkGateways. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listLocalNetworkGateways(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getLocalNetworkGateways().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LocalNetworkGatewaysUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LocalNetworkGatewaysUpdateTagsSamples.java new file mode 100644 index 0000000000000..28a544645c708 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/LocalNetworkGatewaysUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for LocalNetworkGateways UpdateTags. */ +public final class LocalNetworkGatewaysUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/LocalNetworkGatewayUpdateTags.json + */ + /** + * Sample code: UpdateLocalNetworkGatewayTags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateLocalNetworkGatewayTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getLocalNetworkGateways() + .updateTagsWithResponse( + "rg1", "lgw", new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatGatewaysCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatGatewaysCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..8c5bd18fc9a9d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatGatewaysCreateOrUpdateSamples.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.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.NatGatewayInner; +import com.azure.resourcemanager.network.models.NatGatewaySku; +import com.azure.resourcemanager.network.models.NatGatewaySkuName; +import java.util.Arrays; + +/** Samples for NatGateways CreateOrUpdate. */ +public final class NatGatewaysCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NatGatewayCreateOrUpdate.json + */ + /** + * Sample code: Create nat gateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createNatGateway(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNatGateways() + .createOrUpdate( + "rg1", + "test-natgateway", + new NatGatewayInner() + .withLocation("westus") + .withSku(new NatGatewaySku().withName(NatGatewaySkuName.STANDARD)) + .withPublicIpAddresses( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/PublicIpAddress1"))) + .withPublicIpPrefixes( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPPrefixes/PublicIpPrefix1"))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatGatewaysDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatGatewaysDeleteSamples.java new file mode 100644 index 0000000000000..6ec5b0eae8bf7 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatGatewaysDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NatGateways Delete. */ +public final class NatGatewaysDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NatGatewayDelete.json + */ + /** + * Sample code: Delete nat gateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteNatGateway(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getNatGateways().delete("rg1", "test-natGateway", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatGatewaysGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatGatewaysGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..19c4bf545a904 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatGatewaysGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NatGateways GetByResourceGroup. */ +public final class NatGatewaysGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NatGatewayGet.json + */ + /** + * Sample code: Get nat gateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getNatGateway(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNatGateways() + .getByResourceGroupWithResponse("rg1", "test-natGateway", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatGatewaysListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatGatewaysListByResourceGroupSamples.java new file mode 100644 index 0000000000000..49c0270500917 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatGatewaysListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NatGateways ListByResourceGroup. */ +public final class NatGatewaysListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NatGatewayList.json + */ + /** + * Sample code: List nat gateways in resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listNatGatewaysInResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getNatGateways().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatGatewaysListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatGatewaysListSamples.java new file mode 100644 index 0000000000000..b313be7e5bd84 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatGatewaysListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NatGateways List. */ +public final class NatGatewaysListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NatGatewayListAll.json + */ + /** + * Sample code: List all nat gateways. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllNatGateways(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getNatGateways().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatGatewaysUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatGatewaysUpdateTagsSamples.java new file mode 100644 index 0000000000000..89c15110a003c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatGatewaysUpdateTagsSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for NatGateways UpdateTags. */ +public final class NatGatewaysUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NatGatewayUpdateTags.json + */ + /** + * Sample code: Update nat gateway tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateNatGatewayTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNatGateways() + .updateTagsWithResponse( + "rg1", + "test-natGateway", + new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatRulesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..6acf4f8f21d3f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatRulesCreateOrUpdateSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.VpnGatewayNatRuleInner; +import com.azure.resourcemanager.network.models.VpnNatRuleMapping; +import com.azure.resourcemanager.network.models.VpnNatRuleMode; +import com.azure.resourcemanager.network.models.VpnNatRuleType; +import java.util.Arrays; + +/** Samples for NatRules CreateOrUpdate. */ +public final class NatRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NatRulePut.json + */ + /** + * Sample code: NatRulePut. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void natRulePut(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNatRules() + .createOrUpdate( + "rg1", + "gateway1", + "natRule1", + new VpnGatewayNatRuleInner() + .withTypePropertiesType(VpnNatRuleType.STATIC) + .withMode(VpnNatRuleMode.EGRESS_SNAT) + .withInternalMappings(Arrays.asList(new VpnNatRuleMapping().withAddressSpace("10.4.0.0/24"))) + .withExternalMappings(Arrays.asList(new VpnNatRuleMapping().withAddressSpace("192.168.21.0/24"))) + .withIpConfigurationId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/cloudnet1-VNG/ipConfigurations/default"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatRulesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatRulesDeleteSamples.java new file mode 100644 index 0000000000000..f64fe095248e8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatRulesDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NatRules Delete. */ +public final class NatRulesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NatRuleDelete.json + */ + /** + * Sample code: NatRuleDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void natRuleDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getNatRules().delete("rg1", "gateway1", "natRule1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatRulesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatRulesGetSamples.java new file mode 100644 index 0000000000000..c2ca74e7cd8a6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatRulesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NatRules Get. */ +public final class NatRulesGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NatRuleGet.json + */ + /** + * Sample code: NatRuleGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void natRuleGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNatRules() + .getWithResponse("rg1", "gateway1", "natRule1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatRulesListByVpnGatewaySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatRulesListByVpnGatewaySamples.java new file mode 100644 index 0000000000000..ac99a57aac008 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NatRulesListByVpnGatewaySamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NatRules ListByVpnGateway. */ +public final class NatRulesListByVpnGatewaySamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NatRuleList.json + */ + /** + * Sample code: NatRuleList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void natRuleList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getNatRules().listByVpnGateway("rg1", "gateway1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfaceIpConfigurationsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfaceIpConfigurationsGetSamples.java new file mode 100644 index 0000000000000..f46265c59ac8f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfaceIpConfigurationsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkInterfaceIpConfigurations Get. */ +public final class NetworkInterfaceIpConfigurationsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkInterfaceIPConfigurationGet.json + */ + /** + * Sample code: NetworkInterfaceIPConfigurationGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void networkInterfaceIPConfigurationGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkInterfaceIpConfigurations() + .getWithResponse("testrg", "mynic", "ipconfig1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfaceIpConfigurationsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfaceIpConfigurationsListSamples.java new file mode 100644 index 0000000000000..8a613a7cd0f51 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfaceIpConfigurationsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkInterfaceIpConfigurations List. */ +public final class NetworkInterfaceIpConfigurationsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkInterfaceIPConfigurationList.json + */ + /** + * Sample code: NetworkInterfaceIPConfigurationList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void networkInterfaceIPConfigurationList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkInterfaceIpConfigurations() + .list("testrg", "nic1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfaceLoadBalancersListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfaceLoadBalancersListSamples.java new file mode 100644 index 0000000000000..0a05746bebc49 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfaceLoadBalancersListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkInterfaceLoadBalancers List. */ +public final class NetworkInterfaceLoadBalancersListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkInterfaceLoadBalancerList.json + */ + /** + * Sample code: NetworkInterfaceLoadBalancerList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void networkInterfaceLoadBalancerList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkInterfaceLoadBalancers() + .list("testrg", "nic1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfaceTapConfigurationsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfaceTapConfigurationsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..d865d88a91d40 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfaceTapConfigurationsCreateOrUpdateSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.NetworkInterfaceTapConfigurationInner; +import com.azure.resourcemanager.network.fluent.models.VirtualNetworkTapInner; + +/** Samples for NetworkInterfaceTapConfigurations CreateOrUpdate. */ +public final class NetworkInterfaceTapConfigurationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkInterfaceTapConfigurationCreate.json + */ + /** + * Sample code: Create Network Interface Tap Configurations. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createNetworkInterfaceTapConfigurations(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkInterfaceTapConfigurations() + .createOrUpdate( + "testrg", + "mynic", + "tapconfiguration1", + new NetworkInterfaceTapConfigurationInner() + .withVirtualNetworkTap( + new VirtualNetworkTapInner() + .withId( + "/subscriptions/subid/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworkTaps/testvtap")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfaceTapConfigurationsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfaceTapConfigurationsDeleteSamples.java new file mode 100644 index 0000000000000..8eb1406124d5e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfaceTapConfigurationsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkInterfaceTapConfigurations Delete. */ +public final class NetworkInterfaceTapConfigurationsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkInterfaceTapConfigurationDelete.json + */ + /** + * Sample code: Delete tap configuration. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteTapConfiguration(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkInterfaceTapConfigurations() + .delete("rg1", "test-networkinterface", "test-tapconfiguration", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfaceTapConfigurationsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfaceTapConfigurationsGetSamples.java new file mode 100644 index 0000000000000..b1bb4e6ccd333 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfaceTapConfigurationsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkInterfaceTapConfigurations Get. */ +public final class NetworkInterfaceTapConfigurationsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkInterfaceTapConfigurationGet.json + */ + /** + * Sample code: Get Network Interface Tap Configurations. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getNetworkInterfaceTapConfigurations(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkInterfaceTapConfigurations() + .getWithResponse("testrg", "mynic", "tapconfiguration1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfaceTapConfigurationsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfaceTapConfigurationsListSamples.java new file mode 100644 index 0000000000000..e4b9407d45ed3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfaceTapConfigurationsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkInterfaceTapConfigurations List. */ +public final class NetworkInterfaceTapConfigurationsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkInterfaceTapConfigurationList.json + */ + /** + * Sample code: List virtual network tap configurations. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listVirtualNetworkTapConfigurations(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkInterfaceTapConfigurations() + .list("rg1", "mynic", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..932821f04ce0e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesCreateOrUpdateSamples.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.NetworkInterfaceInner; +import com.azure.resourcemanager.network.fluent.models.NetworkInterfaceIpConfigurationInner; +import com.azure.resourcemanager.network.fluent.models.PublicIpAddressInner; +import com.azure.resourcemanager.network.fluent.models.SubnetInner; +import java.util.Arrays; + +/** Samples for NetworkInterfaces CreateOrUpdate. */ +public final class NetworkInterfacesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkInterfaceCreateGatewayLoadBalancerConsumer.json + */ + /** + * Sample code: Create network interface with Gateway Load Balancer Consumer configured. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createNetworkInterfaceWithGatewayLoadBalancerConsumerConfigured( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkInterfaces() + .createOrUpdate( + "rg1", + "test-nic", + new NetworkInterfaceInner() + .withLocation("eastus") + .withIpConfigurations( + Arrays + .asList( + new NetworkInterfaceIpConfigurationInner() + .withName("ipconfig1") + .withGatewayLoadBalancer( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb-provider")) + .withSubnet( + new SubnetInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default")) + .withPublicIpAddress( + new PublicIpAddressInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip")))) + .withEnableAcceleratedNetworking(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkInterfaceCreate.json + */ + /** + * Sample code: Create network interface. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createNetworkInterface(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkInterfaces() + .createOrUpdate( + "rg1", + "test-nic", + new NetworkInterfaceInner() + .withLocation("eastus") + .withIpConfigurations( + Arrays + .asList( + new NetworkInterfaceIpConfigurationInner() + .withName("ipconfig1") + .withSubnet( + new SubnetInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/rg1-vnet/subnets/default")) + .withPublicIpAddress( + new PublicIpAddressInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/test-ip")))) + .withEnableAcceleratedNetworking(true), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesDeleteSamples.java new file mode 100644 index 0000000000000..b3c6a90e3b78c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkInterfaces Delete. */ +public final class NetworkInterfacesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkInterfaceDelete.json + */ + /** + * Sample code: Delete network interface. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteNetworkInterface(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getNetworkInterfaces().delete("rg1", "test-nic", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..8e2f015f0fa1a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkInterfaces GetByResourceGroup. */ +public final class NetworkInterfacesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkInterfaceGet.json + */ + /** + * Sample code: Get network interface. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getNetworkInterface(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkInterfaces() + .getByResourceGroupWithResponse("rg1", "test-nic", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesGetCloudServiceNetworkInterfaceSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesGetCloudServiceNetworkInterfaceSamples.java new file mode 100644 index 0000000000000..4ab924644417d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesGetCloudServiceNetworkInterfaceSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkInterfaces GetCloudServiceNetworkInterface. */ +public final class NetworkInterfacesGetCloudServiceNetworkInterfaceSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/CloudServiceNetworkInterfaceGet.json + */ + /** + * Sample code: Get cloud service network interface. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getCloudServiceNetworkInterface(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkInterfaces() + .getCloudServiceNetworkInterfaceWithResponse("rg1", "cs1", "TestVMRole_IN_0", "nic1", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesGetEffectiveRouteTableSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesGetEffectiveRouteTableSamples.java new file mode 100644 index 0000000000000..29f00900190e2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesGetEffectiveRouteTableSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkInterfaces GetEffectiveRouteTable. */ +public final class NetworkInterfacesGetEffectiveRouteTableSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkInterfaceEffectiveRouteTableList.json + */ + /** + * Sample code: Show network interface effective route tables. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void showNetworkInterfaceEffectiveRouteTables(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkInterfaces() + .getEffectiveRouteTable("rg1", "nic1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesGetVirtualMachineScaleSetIpConfigurationSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesGetVirtualMachineScaleSetIpConfigurationSamples.java new file mode 100644 index 0000000000000..56657c50d5b6c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesGetVirtualMachineScaleSetIpConfigurationSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkInterfaces GetVirtualMachineScaleSetIpConfiguration. */ +public final class NetworkInterfacesGetVirtualMachineScaleSetIpConfigurationSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VmssNetworkInterfaceIpConfigGet.json + */ + /** + * Sample code: Get virtual machine scale set network interface. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualMachineScaleSetNetworkInterface(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkInterfaces() + .getVirtualMachineScaleSetIpConfigurationWithResponse( + "rg1", "vmss1", "2", "nic1", "ip1", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesGetVirtualMachineScaleSetNetworkInterfaceSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesGetVirtualMachineScaleSetNetworkInterfaceSamples.java new file mode 100644 index 0000000000000..96b67cb3e2e3b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesGetVirtualMachineScaleSetNetworkInterfaceSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkInterfaces GetVirtualMachineScaleSetNetworkInterface. */ +public final class NetworkInterfacesGetVirtualMachineScaleSetNetworkInterfaceSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VmssNetworkInterfaceGet.json + */ + /** + * Sample code: Get virtual machine scale set network interface. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualMachineScaleSetNetworkInterface(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkInterfaces() + .getVirtualMachineScaleSetNetworkInterfaceWithResponse("rg1", "vmss1", "1", "nic1", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..c0a91b624e857 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkInterfaces ListByResourceGroup. */ +public final class NetworkInterfacesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkInterfaceList.json + */ + /** + * Sample code: List network interfaces in resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listNetworkInterfacesInResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getNetworkInterfaces().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListCloudServiceNetworkInterfacesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListCloudServiceNetworkInterfacesSamples.java new file mode 100644 index 0000000000000..e77be3a0b3ed0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListCloudServiceNetworkInterfacesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkInterfaces ListCloudServiceNetworkInterfaces. */ +public final class NetworkInterfacesListCloudServiceNetworkInterfacesSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/CloudServiceNetworkInterfaceList.json + */ + /** + * Sample code: List cloud service network interfaces. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listCloudServiceNetworkInterfaces(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkInterfaces() + .listCloudServiceNetworkInterfaces("rg1", "cs1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListCloudServiceRoleInstanceNetworkInterfacesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListCloudServiceRoleInstanceNetworkInterfacesSamples.java new file mode 100644 index 0000000000000..841741dd5b0bf --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListCloudServiceRoleInstanceNetworkInterfacesSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkInterfaces ListCloudServiceRoleInstanceNetworkInterfaces. */ +public final class NetworkInterfacesListCloudServiceRoleInstanceNetworkInterfacesSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/CloudServiceRoleInstanceNetworkInterfaceList.json + */ + /** + * Sample code: List cloud service role instance network interfaces. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listCloudServiceRoleInstanceNetworkInterfaces( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkInterfaces() + .listCloudServiceRoleInstanceNetworkInterfaces("rg1", "cs1", "TestVMRole_IN_0", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListEffectiveNetworkSecurityGroupsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListEffectiveNetworkSecurityGroupsSamples.java new file mode 100644 index 0000000000000..4939748f72235 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListEffectiveNetworkSecurityGroupsSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkInterfaces ListEffectiveNetworkSecurityGroups. */ +public final class NetworkInterfacesListEffectiveNetworkSecurityGroupsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkInterfaceEffectiveNSGList.json + */ + /** + * Sample code: List network interface effective network security groups. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listNetworkInterfaceEffectiveNetworkSecurityGroups( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkInterfaces() + .listEffectiveNetworkSecurityGroups("rg1", "nic1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListSamples.java new file mode 100644 index 0000000000000..e57f33bb8051f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkInterfaces List. */ +public final class NetworkInterfacesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkInterfaceListAll.json + */ + /** + * Sample code: List all network interfaces. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllNetworkInterfaces(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getNetworkInterfaces().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListVirtualMachineScaleSetIpConfigurationsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListVirtualMachineScaleSetIpConfigurationsSamples.java new file mode 100644 index 0000000000000..f2db7fcf48aef --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListVirtualMachineScaleSetIpConfigurationsSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkInterfaces ListVirtualMachineScaleSetIpConfigurations. */ +public final class NetworkInterfacesListVirtualMachineScaleSetIpConfigurationsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VmssNetworkInterfaceIpConfigList.json + */ + /** + * Sample code: List virtual machine scale set network interface ip configurations. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listVirtualMachineScaleSetNetworkInterfaceIpConfigurations( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkInterfaces() + .listVirtualMachineScaleSetIpConfigurations("rg1", "vmss1", "2", "nic1", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListVirtualMachineScaleSetNetworkInterfacesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListVirtualMachineScaleSetNetworkInterfacesSamples.java new file mode 100644 index 0000000000000..d0d996ba86869 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListVirtualMachineScaleSetNetworkInterfacesSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkInterfaces ListVirtualMachineScaleSetNetworkInterfaces. */ +public final class NetworkInterfacesListVirtualMachineScaleSetNetworkInterfacesSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VmssNetworkInterfaceList.json + */ + /** + * Sample code: List virtual machine scale set network interfaces. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listVirtualMachineScaleSetNetworkInterfaces( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkInterfaces() + .listVirtualMachineScaleSetNetworkInterfaces("rg1", "vmss1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListVirtualMachineScaleSetVMNetworkInterfacesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListVirtualMachineScaleSetVMNetworkInterfacesSamples.java new file mode 100644 index 0000000000000..8d7df1a53274c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesListVirtualMachineScaleSetVMNetworkInterfacesSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkInterfaces ListVirtualMachineScaleSetVMNetworkInterfaces. */ +public final class NetworkInterfacesListVirtualMachineScaleSetVMNetworkInterfacesSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VmssVmNetworkInterfaceList.json + */ + /** + * Sample code: List virtual machine scale set vm network interfaces. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listVirtualMachineScaleSetVmNetworkInterfaces( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkInterfaces() + .listVirtualMachineScaleSetVMNetworkInterfaces("rg1", "vmss1", "1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesUpdateTagsSamples.java new file mode 100644 index 0000000000000..873f1e48531a1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkInterfacesUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for NetworkInterfaces UpdateTags. */ +public final class NetworkInterfacesUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkInterfaceUpdateTags.json + */ + /** + * Sample code: Update network interface tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateNetworkInterfaceTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkInterfaces() + .updateTagsWithResponse( + "rg1", "test-nic", new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkProfilesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkProfilesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..69fe64aaed05d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkProfilesCreateOrUpdateSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.IpConfigurationProfileInner; +import com.azure.resourcemanager.network.fluent.models.NetworkProfileInner; +import com.azure.resourcemanager.network.fluent.models.SubnetInner; +import com.azure.resourcemanager.network.models.ContainerNetworkInterfaceConfiguration; +import java.util.Arrays; + +/** Samples for NetworkProfiles CreateOrUpdate. */ +public final class NetworkProfilesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkProfileCreateConfigOnly.json + */ + /** + * Sample code: Create network profile defaults. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createNetworkProfileDefaults(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkProfiles() + .createOrUpdateWithResponse( + "rg1", + "networkProfile1", + new NetworkProfileInner() + .withLocation("westus") + .withContainerNetworkInterfaceConfigurations( + Arrays + .asList( + new ContainerNetworkInterfaceConfiguration() + .withName("eth1") + .withIpConfigurations( + Arrays + .asList( + new IpConfigurationProfileInner() + .withName("ipconfig1") + .withSubnet( + new SubnetInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/networkProfileVnet/subnets/networkProfileSubnet1")))))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkProfilesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkProfilesDeleteSamples.java new file mode 100644 index 0000000000000..c82b34eb7367e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkProfilesDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkProfiles Delete. */ +public final class NetworkProfilesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkProfileDelete.json + */ + /** + * Sample code: Delete network profile. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteNetworkProfile(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getNetworkProfiles().delete("rg1", "networkProfile1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkProfilesGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkProfilesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..afcf29edffc7b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkProfilesGetByResourceGroupSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkProfiles GetByResourceGroup. */ +public final class NetworkProfilesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkProfileGetWithContainerNic.json + */ + /** + * Sample code: Get network profile with container network interfaces. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getNetworkProfileWithContainerNetworkInterfaces( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkProfiles() + .getByResourceGroupWithResponse("rg1", "networkProfile1", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkProfileGetConfigOnly.json + */ + /** + * Sample code: Get network profile. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getNetworkProfile(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkProfiles() + .getByResourceGroupWithResponse("rg1", "networkProfile1", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkProfilesListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkProfilesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..7a00083891f85 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkProfilesListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkProfiles ListByResourceGroup. */ +public final class NetworkProfilesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkProfileList.json + */ + /** + * Sample code: List resource group network profiles. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listResourceGroupNetworkProfiles(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getNetworkProfiles().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkProfilesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkProfilesListSamples.java new file mode 100644 index 0000000000000..37484673a0766 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkProfilesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkProfiles List. */ +public final class NetworkProfilesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkProfileListAll.json + */ + /** + * Sample code: List all network profiles. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllNetworkProfiles(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getNetworkProfiles().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkProfilesUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkProfilesUpdateTagsSamples.java new file mode 100644 index 0000000000000..971d26d9d3a76 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkProfilesUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for NetworkProfiles UpdateTags. */ +public final class NetworkProfilesUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkProfileUpdateTags.json + */ + /** + * Sample code: Update network profile tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateNetworkProfileTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkProfiles() + .updateTagsWithResponse( + "rg1", "test-np", new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkSecurityGroupsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkSecurityGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..1e7675ebc6556 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkSecurityGroupsCreateOrUpdateSamples.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.NetworkSecurityGroupInner; +import com.azure.resourcemanager.network.fluent.models.SecurityRuleInner; +import com.azure.resourcemanager.network.models.SecurityRuleAccess; +import com.azure.resourcemanager.network.models.SecurityRuleDirection; +import com.azure.resourcemanager.network.models.SecurityRuleProtocol; +import java.util.Arrays; + +/** Samples for NetworkSecurityGroups CreateOrUpdate. */ +public final class NetworkSecurityGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkSecurityGroupCreateWithRule.json + */ + /** + * Sample code: Create network security group with rule. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createNetworkSecurityGroupWithRule(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkSecurityGroups() + .createOrUpdate( + "rg1", + "testnsg", + new NetworkSecurityGroupInner() + .withLocation("eastus") + .withSecurityRules( + Arrays + .asList( + new SecurityRuleInner() + .withName("rule1") + .withProtocol(SecurityRuleProtocol.ASTERISK) + .withSourcePortRange("*") + .withDestinationPortRange("80") + .withSourceAddressPrefix("*") + .withDestinationAddressPrefix("*") + .withAccess(SecurityRuleAccess.ALLOW) + .withPriority(130) + .withDirection(SecurityRuleDirection.INBOUND))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkSecurityGroupCreate.json + */ + /** + * Sample code: Create network security group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createNetworkSecurityGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkSecurityGroups() + .createOrUpdate("rg1", "testnsg", new NetworkSecurityGroupInner().withLocation("eastus"), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkSecurityGroupsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkSecurityGroupsDeleteSamples.java new file mode 100644 index 0000000000000..16b7f0d80beb8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkSecurityGroupsDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkSecurityGroups Delete. */ +public final class NetworkSecurityGroupsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkSecurityGroupDelete.json + */ + /** + * Sample code: Delete network security group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteNetworkSecurityGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getNetworkSecurityGroups().delete("rg1", "testnsg", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkSecurityGroupsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkSecurityGroupsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..206c050d60d74 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkSecurityGroupsGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkSecurityGroups GetByResourceGroup. */ +public final class NetworkSecurityGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkSecurityGroupGet.json + */ + /** + * Sample code: Get network security group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getNetworkSecurityGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkSecurityGroups() + .getByResourceGroupWithResponse("rg1", "testnsg", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkSecurityGroupsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkSecurityGroupsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..7647d9bdca2a2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkSecurityGroupsListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkSecurityGroups ListByResourceGroup. */ +public final class NetworkSecurityGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkSecurityGroupList.json + */ + /** + * Sample code: List network security groups in resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listNetworkSecurityGroupsInResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getNetworkSecurityGroups().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkSecurityGroupsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkSecurityGroupsListSamples.java new file mode 100644 index 0000000000000..d3a98de34c385 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkSecurityGroupsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkSecurityGroups List. */ +public final class NetworkSecurityGroupsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkSecurityGroupListAll.json + */ + /** + * Sample code: List all network security groups. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllNetworkSecurityGroups(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getNetworkSecurityGroups().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkSecurityGroupsUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkSecurityGroupsUpdateTagsSamples.java new file mode 100644 index 0000000000000..86352a1f50d8b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkSecurityGroupsUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for NetworkSecurityGroups UpdateTags. */ +public final class NetworkSecurityGroupsUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkSecurityGroupUpdateTags.json + */ + /** + * Sample code: Update network security group tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateNetworkSecurityGroupTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkSecurityGroups() + .updateTagsWithResponse( + "rg1", "testnsg", new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkVirtualAppliancesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkVirtualAppliancesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..7f95c3547c1a2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkVirtualAppliancesCreateOrUpdateSamples.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.NetworkVirtualApplianceInner; +import com.azure.resourcemanager.network.models.ManagedServiceIdentity; +import com.azure.resourcemanager.network.models.ManagedServiceIdentityUserAssignedIdentities; +import com.azure.resourcemanager.network.models.ResourceIdentityType; +import com.azure.resourcemanager.network.models.VirtualApplianceSkuProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for NetworkVirtualAppliances CreateOrUpdate. */ +public final class NetworkVirtualAppliancesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkVirtualAppliancePut.json + */ + /** + * Sample code: Create NetworkVirtualAppliance. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createNetworkVirtualAppliance(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkVirtualAppliances() + .createOrUpdate( + "rg1", + "nva", + new NetworkVirtualApplianceInner() + .withLocation("West US") + .withTags(mapOf("key1", "value1")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1", + new ManagedServiceIdentityUserAssignedIdentities()))) + .withNvaSku( + new VirtualApplianceSkuProperties() + .withVendor("Cisco SDWAN") + .withBundledScaleUnit("1") + .withMarketPlaceVersion("12.1")) + .withBootStrapConfigurationBlobs( + Arrays + .asList( + "https://csrncvhdstorage1.blob.core.windows.net/csrncvhdstoragecont/csrbootstrapconfig")) + .withVirtualHub( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1")) + .withCloudInitConfigurationBlobs( + Arrays + .asList( + "https://csrncvhdstorage1.blob.core.windows.net/csrncvhdstoragecont/csrcloudinitconfig")) + .withVirtualApplianceAsn(10000L), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkVirtualAppliancesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkVirtualAppliancesDeleteSamples.java new file mode 100644 index 0000000000000..f1b61cf25c040 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkVirtualAppliancesDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkVirtualAppliances Delete. */ +public final class NetworkVirtualAppliancesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkVirtualApplianceDelete.json + */ + /** + * Sample code: Delete NetworkVirtualAppliance. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteNetworkVirtualAppliance(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getNetworkVirtualAppliances().delete("rg1", "nva", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkVirtualAppliancesGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkVirtualAppliancesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..67b4f66384b56 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkVirtualAppliancesGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkVirtualAppliances GetByResourceGroup. */ +public final class NetworkVirtualAppliancesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkVirtualApplianceGet.json + */ + /** + * Sample code: Get NetworkVirtualAppliance. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getNetworkVirtualAppliance(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkVirtualAppliances() + .getByResourceGroupWithResponse("rg1", "nva", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkVirtualAppliancesListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkVirtualAppliancesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..f001664a8f5dc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkVirtualAppliancesListByResourceGroupSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkVirtualAppliances ListByResourceGroup. */ +public final class NetworkVirtualAppliancesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkVirtualApplianceListByResourceGroup.json + */ + /** + * Sample code: List all Network Virtual Appliance for a given resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllNetworkVirtualApplianceForAGivenResourceGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkVirtualAppliances() + .listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkVirtualAppliancesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkVirtualAppliancesListSamples.java new file mode 100644 index 0000000000000..9ce9a48a0ccaf --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkVirtualAppliancesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkVirtualAppliances List. */ +public final class NetworkVirtualAppliancesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkVirtualApplianceListBySubscription.json + */ + /** + * Sample code: List all Network Virtual Appliances for a given subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllNetworkVirtualAppliancesForAGivenSubscription( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getNetworkVirtualAppliances().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkVirtualAppliancesUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkVirtualAppliancesUpdateTagsSamples.java new file mode 100644 index 0000000000000..622f802ccf29a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkVirtualAppliancesUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for NetworkVirtualAppliances UpdateTags. */ +public final class NetworkVirtualAppliancesUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkVirtualApplianceUpdateTags.json + */ + /** + * Sample code: Update NetworkVirtualAppliance. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateNetworkVirtualAppliance(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkVirtualAppliances() + .updateTagsWithResponse( + "rg1", "nva", new TagsObject().withTags(mapOf("key1", "value1", "key2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersCheckConnectivitySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersCheckConnectivitySamples.java new file mode 100644 index 0000000000000..b23d063fd97dd --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersCheckConnectivitySamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.ConnectivityDestination; +import com.azure.resourcemanager.network.models.ConnectivityParameters; +import com.azure.resourcemanager.network.models.ConnectivitySource; +import com.azure.resourcemanager.network.models.IpVersion; + +/** Samples for NetworkWatchers CheckConnectivity. */ +public final class NetworkWatchersCheckConnectivitySamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherConnectivityCheck.json + */ + /** + * Sample code: Check connectivity. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void checkConnectivity(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkWatchers() + .checkConnectivity( + "rg1", + "nw1", + new ConnectivityParameters() + .withSource( + new ConnectivitySource() + .withResourceId( + "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1")) + .withDestination(new ConnectivityDestination().withAddress("192.168.100.4").withPort(3389)) + .withPreferredIpVersion(IpVersion.IPV4), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..ca6a51de4cf83 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersCreateOrUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.NetworkWatcherInner; + +/** Samples for NetworkWatchers CreateOrUpdate. */ +public final class NetworkWatchersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherCreate.json + */ + /** + * Sample code: Create network watcher. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createNetworkWatcher(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkWatchers() + .createOrUpdateWithResponse("rg1", "nw1", new NetworkWatcherInner().withLocation("eastus"), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersDeleteSamples.java new file mode 100644 index 0000000000000..94f5d137de0ad --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkWatchers Delete. */ +public final class NetworkWatchersDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherDelete.json + */ + /** + * Sample code: Delete network watcher. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteNetworkWatcher(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getNetworkWatchers().delete("rg1", "nw1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetAzureReachabilityReportSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetAzureReachabilityReportSamples.java new file mode 100644 index 0000000000000..bb5b470c61d83 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetAzureReachabilityReportSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.AzureReachabilityReportLocation; +import com.azure.resourcemanager.network.models.AzureReachabilityReportParameters; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for NetworkWatchers GetAzureReachabilityReport. */ +public final class NetworkWatchersGetAzureReachabilityReportSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherAzureReachabilityReportGet.json + */ + /** + * Sample code: Get Azure Reachability Report. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAzureReachabilityReport(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkWatchers() + .getAzureReachabilityReport( + "rg1", + "nw1", + new AzureReachabilityReportParameters() + .withProviderLocation( + new AzureReachabilityReportLocation().withCountry("United States").withState("washington")) + .withProviders(Arrays.asList("Frontier Communications of America, Inc. - ASN 5650")) + .withAzureLocations(Arrays.asList("West US")) + .withStartTime(OffsetDateTime.parse("2017-09-07T00:00:00Z")) + .withEndTime(OffsetDateTime.parse("2017-09-10T00:00:00Z")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..c68eaf11c76d0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkWatchers GetByResourceGroup. */ +public final class NetworkWatchersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherGet.json + */ + /** + * Sample code: Get network watcher. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getNetworkWatcher(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkWatchers() + .getByResourceGroupWithResponse("rg1", "nw1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetFlowLogStatusSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetFlowLogStatusSamples.java new file mode 100644 index 0000000000000..3b8bad70e662a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetFlowLogStatusSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.FlowLogStatusParameters; + +/** Samples for NetworkWatchers GetFlowLogStatus. */ +public final class NetworkWatchersGetFlowLogStatusSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherFlowLogStatusQuery.json + */ + /** + * Sample code: Get flow log status. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getFlowLogStatus(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkWatchers() + .getFlowLogStatus( + "rg1", + "nw1", + new FlowLogStatusParameters() + .withTargetResourceId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetNetworkConfigurationDiagnosticSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetNetworkConfigurationDiagnosticSamples.java new file mode 100644 index 0000000000000..affa33ef59407 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetNetworkConfigurationDiagnosticSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.Direction; +import com.azure.resourcemanager.network.models.NetworkConfigurationDiagnosticParameters; +import com.azure.resourcemanager.network.models.NetworkConfigurationDiagnosticProfile; +import java.util.Arrays; + +/** Samples for NetworkWatchers GetNetworkConfigurationDiagnostic. */ +public final class NetworkWatchersGetNetworkConfigurationDiagnosticSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherNetworkConfigurationDiagnostic.json + */ + /** + * Sample code: Network configuration diagnostic. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void networkConfigurationDiagnostic(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkWatchers() + .getNetworkConfigurationDiagnostic( + "rg1", + "nw1", + new NetworkConfigurationDiagnosticParameters() + .withTargetResourceId( + "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1") + .withProfiles( + Arrays + .asList( + new NetworkConfigurationDiagnosticProfile() + .withDirection(Direction.INBOUND) + .withProtocol("TCP") + .withSource("10.1.0.4") + .withDestination("12.11.12.14") + .withDestinationPort("12100"))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetNextHopSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetNextHopSamples.java new file mode 100644 index 0000000000000..c725910ca1cf2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetNextHopSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.NextHopParameters; + +/** Samples for NetworkWatchers GetNextHop. */ +public final class NetworkWatchersGetNextHopSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherNextHopGet.json + */ + /** + * Sample code: Get next hop. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getNextHop(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkWatchers() + .getNextHop( + "rg1", + "nw1", + new NextHopParameters() + .withTargetResourceId( + "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1") + .withSourceIpAddress("10.0.0.5") + .withDestinationIpAddress("10.0.0.10") + .withTargetNicResourceId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/nic1"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetTopologySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetTopologySamples.java new file mode 100644 index 0000000000000..0eefab9c43d59 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetTopologySamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TopologyParameters; + +/** Samples for NetworkWatchers GetTopology. */ +public final class NetworkWatchersGetTopologySamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherTopologyGet.json + */ + /** + * Sample code: Get Topology. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getTopology(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkWatchers() + .getTopologyWithResponse( + "rg1", "nw1", new TopologyParameters().withTargetResourceGroupName("rg2"), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetTroubleshootingResultSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetTroubleshootingResultSamples.java new file mode 100644 index 0000000000000..7ce2d0a204013 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetTroubleshootingResultSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.QueryTroubleshootingParameters; + +/** Samples for NetworkWatchers GetTroubleshootingResult. */ +public final class NetworkWatchersGetTroubleshootingResultSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherTroubleshootResultQuery.json + */ + /** + * Sample code: Get troubleshoot result. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getTroubleshootResult(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkWatchers() + .getTroubleshootingResult( + "rg1", + "nw1", + new QueryTroubleshootingParameters() + .withTargetResourceId( + "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetTroubleshootingSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetTroubleshootingSamples.java new file mode 100644 index 0000000000000..455e0ab576630 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetTroubleshootingSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TroubleshootingParameters; + +/** Samples for NetworkWatchers GetTroubleshooting. */ +public final class NetworkWatchersGetTroubleshootingSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherTroubleshootGet.json + */ + /** + * Sample code: Get troubleshooting. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getTroubleshooting(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkWatchers() + .getTroubleshooting( + "rg1", + "nw1", + new TroubleshootingParameters() + .withTargetResourceId( + "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1") + .withStorageId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/st1") + .withStoragePath("https://st1.blob.core.windows.net/cn1"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetVMSecurityRulesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetVMSecurityRulesSamples.java new file mode 100644 index 0000000000000..d58e4e35abddc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersGetVMSecurityRulesSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.SecurityGroupViewParameters; + +/** Samples for NetworkWatchers GetVMSecurityRules. */ +public final class NetworkWatchersGetVMSecurityRulesSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherSecurityGroupViewGet.json + */ + /** + * Sample code: Get security group view. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getSecurityGroupView(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkWatchers() + .getVMSecurityRules( + "rg1", + "nw1", + new SecurityGroupViewParameters() + .withTargetResourceId( + "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersListAvailableProvidersSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersListAvailableProvidersSamples.java new file mode 100644 index 0000000000000..92c423175cf35 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersListAvailableProvidersSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.AvailableProvidersListParameters; +import java.util.Arrays; + +/** Samples for NetworkWatchers ListAvailableProviders. */ +public final class NetworkWatchersListAvailableProvidersSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherAvailableProvidersListGet.json + */ + /** + * Sample code: Get Available Providers List. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAvailableProvidersList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkWatchers() + .listAvailableProviders( + "rg1", + "nw1", + new AvailableProvidersListParameters() + .withAzureLocations(Arrays.asList("West US")) + .withCountry("United States") + .withState("washington") + .withCity("seattle"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersListByResourceGroupSamples.java new file mode 100644 index 0000000000000..01454fc30e6b4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkWatchers ListByResourceGroup. */ +public final class NetworkWatchersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherList.json + */ + /** + * Sample code: List network watchers. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listNetworkWatchers(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getNetworkWatchers().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersListSamples.java new file mode 100644 index 0000000000000..91e3b53452727 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for NetworkWatchers List. */ +public final class NetworkWatchersListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherListAll.json + */ + /** + * Sample code: List all network watchers. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllNetworkWatchers(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getNetworkWatchers().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersSetFlowLogConfigurationSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersSetFlowLogConfigurationSamples.java new file mode 100644 index 0000000000000..c98584d5f8ce3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersSetFlowLogConfigurationSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.FlowLogInformationInner; + +/** Samples for NetworkWatchers SetFlowLogConfiguration. */ +public final class NetworkWatchersSetFlowLogConfigurationSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherFlowLogConfigure.json + */ + /** + * Sample code: Configure flow log. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void configureFlowLog(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkWatchers() + .setFlowLogConfiguration( + "rg1", + "nw1", + new FlowLogInformationInner() + .withTargetResourceId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1") + .withStorageId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/st1") + .withEnabled(true), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersUpdateTagsSamples.java new file mode 100644 index 0000000000000..328d03b70ec55 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for NetworkWatchers UpdateTags. */ +public final class NetworkWatchersUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherUpdateTags.json + */ + /** + * Sample code: Update network watcher tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateNetworkWatcherTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkWatchers() + .updateTagsWithResponse( + "rg1", "nw1", new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersVerifyIpFlowSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersVerifyIpFlowSamples.java new file mode 100644 index 0000000000000..31800d68cfb02 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/NetworkWatchersVerifyIpFlowSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.Direction; +import com.azure.resourcemanager.network.models.IpFlowProtocol; +import com.azure.resourcemanager.network.models.VerificationIpFlowParameters; + +/** Samples for NetworkWatchers VerifyIpFlow. */ +public final class NetworkWatchersVerifyIpFlowSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherIpFlowVerify.json + */ + /** + * Sample code: Ip flow verify. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void ipFlowVerify(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getNetworkWatchers() + .verifyIpFlow( + "rg1", + "nw1", + new VerificationIpFlowParameters() + .withTargetResourceId( + "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1") + .withDirection(Direction.OUTBOUND) + .withProtocol(IpFlowProtocol.TCP) + .withLocalPort("80") + .withRemotePort("80") + .withLocalIpAddress("10.2.0.4") + .withRemoteIpAddress("121.10.1.1"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/OperationsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..832f1aee42b22 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/OperationList.json + */ + /** + * Sample code: Get a list of operations for a resource provider. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAListOfOperationsForAResourceProvider(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getOperations().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e54dda8ddcfb9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysCreateOrUpdateSamples.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.P2SVpnGatewayInner; +import com.azure.resourcemanager.network.models.AddressSpace; +import com.azure.resourcemanager.network.models.P2SConnectionConfiguration; +import com.azure.resourcemanager.network.models.PropagatedRouteTable; +import com.azure.resourcemanager.network.models.RoutingConfiguration; +import com.azure.resourcemanager.network.models.VnetRoute; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for P2SVpnGateways CreateOrUpdate. */ +public final class P2SVpnGatewaysCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/P2SVpnGatewayPut.json + */ + /** + * Sample code: P2SVpnGatewayPut. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void p2SVpnGatewayPut(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getP2SVpnGateways() + .createOrUpdate( + "rg1", + "p2sVpnGateway1", + new P2SVpnGatewayInner() + .withLocation("West US") + .withTags(mapOf("key1", "value1")) + .withVirtualHub( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1")) + .withP2SConnectionConfigurations( + Arrays + .asList( + new P2SConnectionConfiguration() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/p2sVpnGateways/p2sVpnGateway1/p2sConnectionConfigurations/P2SConnectionConfig1") + .withName("P2SConnectionConfig1") + .withVpnClientAddressPool( + new AddressSpace().withAddressPrefixes(Arrays.asList("101.3.0.0/16"))) + .withRoutingConfiguration( + new RoutingConfiguration() + .withAssociatedRouteTable( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1")) + .withPropagatedRouteTables( + new PropagatedRouteTable() + .withLabels(Arrays.asList("label1", "label2")) + .withIds( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1"), + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable2"), + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable3")))) + .withVnetRoutes(new VnetRoute().withStaticRoutes(Arrays.asList()))))) + .withVpnGatewayScaleUnit(1) + .withVpnServerConfiguration( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnServerConfigurations/vpnServerConfiguration1")) + .withCustomDnsServers(Arrays.asList("1.1.1.1", "2.2.2.2")) + .withIsRoutingPreferenceInternet(false), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysDeleteSamples.java new file mode 100644 index 0000000000000..b4907696f153f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for P2SVpnGateways Delete. */ +public final class P2SVpnGatewaysDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/P2SVpnGatewayDelete.json + */ + /** + * Sample code: P2SVpnGatewayDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void p2SVpnGatewayDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getP2SVpnGateways().delete("rg1", "p2sVpnGateway1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysDisconnectP2SVpnConnectionsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysDisconnectP2SVpnConnectionsSamples.java new file mode 100644 index 0000000000000..c923da711a6a1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysDisconnectP2SVpnConnectionsSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.P2SVpnConnectionRequest; +import java.util.Arrays; + +/** Samples for P2SVpnGateways DisconnectP2SVpnConnections. */ +public final class P2SVpnGatewaysDisconnectP2SVpnConnectionsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/P2sVpnGatewaysDisconnectP2sVpnConnections.json + */ + /** + * Sample code: Disconnect VpnConnections from P2sVpn Gateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void disconnectVpnConnectionsFromP2sVpnGateway(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getP2SVpnGateways() + .disconnectP2SVpnConnections( + "p2s-vpn-gateway-test", + "p2svpngateway", + new P2SVpnConnectionRequest().withVpnConnectionIds(Arrays.asList("vpnconnId1", "vpnconnId2")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysGenerateVpnProfileSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysGenerateVpnProfileSamples.java new file mode 100644 index 0000000000000..b7056b19a423e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysGenerateVpnProfileSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.AuthenticationMethod; +import com.azure.resourcemanager.network.models.P2SVpnProfileParameters; + +/** Samples for P2SVpnGateways GenerateVpnProfile. */ +public final class P2SVpnGatewaysGenerateVpnProfileSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/P2SVpnGatewayGenerateVpnProfile.json + */ + /** + * Sample code: GenerateP2SVpnGatewayVPNProfile. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void generateP2SVpnGatewayVPNProfile(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getP2SVpnGateways() + .generateVpnProfile( + "rg1", + "p2sVpnGateway1", + new P2SVpnProfileParameters().withAuthenticationMethod(AuthenticationMethod.EAPTLS), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..b1f01e13e21c8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for P2SVpnGateways GetByResourceGroup. */ +public final class P2SVpnGatewaysGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/P2SVpnGatewayGet.json + */ + /** + * Sample code: P2SVpnGatewayGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void p2SVpnGatewayGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getP2SVpnGateways() + .getByResourceGroupWithResponse("rg1", "p2sVpnGateway1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysGetP2SVpnConnectionHealthDetailedSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysGetP2SVpnConnectionHealthDetailedSamples.java new file mode 100644 index 0000000000000..c0fbffe838086 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysGetP2SVpnConnectionHealthDetailedSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.P2SVpnConnectionHealthRequest; +import java.util.Arrays; + +/** Samples for P2SVpnGateways GetP2SVpnConnectionHealthDetailed. */ +public final class P2SVpnGatewaysGetP2SVpnConnectionHealthDetailedSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/P2SVpnGatewayGetConnectionHealthDetailed.json + */ + /** + * Sample code: P2SVpnGatewayGetConnectionHealthDetailed. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void p2SVpnGatewayGetConnectionHealthDetailed(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getP2SVpnGateways() + .getP2SVpnConnectionHealthDetailed( + "p2s-vpn-gateway-test", + "p2svpngateway", + new P2SVpnConnectionHealthRequest() + .withVpnUserNamesFilter(Arrays.asList("vpnUser1", "vpnUser2")) + .withOutputBlobSasUrl( + "https://blobcortextesturl.blob.core.windows.net/folderforconfig/p2sconnectionhealths?sp=rw&se=2018-01-10T03%3A42%3A04Z&sv=2017-04-17&sig=WvXrT5bDmDFfgHs%2Brz%2BjAu123eRCNE9BO0eQYcPDT7pY%3D&sr=b"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysGetP2SVpnConnectionHealthSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysGetP2SVpnConnectionHealthSamples.java new file mode 100644 index 0000000000000..d6e8b1df93a6b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysGetP2SVpnConnectionHealthSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for P2SVpnGateways GetP2SVpnConnectionHealth. */ +public final class P2SVpnGatewaysGetP2SVpnConnectionHealthSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/P2SVpnGatewayGetConnectionHealth.json + */ + /** + * Sample code: P2SVpnGatewayGetConnectionHealth. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void p2SVpnGatewayGetConnectionHealth(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getP2SVpnGateways() + .getP2SVpnConnectionHealth("rg1", "p2sVpnGateway1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysListByResourceGroupSamples.java new file mode 100644 index 0000000000000..f45b7bafdf8e5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for P2SVpnGateways ListByResourceGroup. */ +public final class P2SVpnGatewaysListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/P2SVpnGatewayListByResourceGroup.json + */ + /** + * Sample code: P2SVpnGatewayListByResourceGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void p2SVpnGatewayListByResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getP2SVpnGateways().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysListSamples.java new file mode 100644 index 0000000000000..2e87ab06aef7b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for P2SVpnGateways List. */ +public final class P2SVpnGatewaysListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/P2SVpnGatewayList.json + */ + /** + * Sample code: P2SVpnGatewayListBySubscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void p2SVpnGatewayListBySubscription(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getP2SVpnGateways().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysResetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysResetSamples.java new file mode 100644 index 0000000000000..6f0ee9e6a52ab --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysResetSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for P2SVpnGateways Reset. */ +public final class P2SVpnGatewaysResetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/P2SVpnGatewayReset.json + */ + /** + * Sample code: ResetP2SVpnGateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void resetP2SVpnGateway(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getP2SVpnGateways().reset("rg1", "p2sVpnGateway1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysUpdateTagsSamples.java new file mode 100644 index 0000000000000..21846ac09cf44 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/P2SVpnGatewaysUpdateTagsSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for P2SVpnGateways UpdateTags. */ +public final class P2SVpnGatewaysUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/P2SVpnGatewayUpdateTags.json + */ + /** + * Sample code: P2SVpnGatewayUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void p2SVpnGatewayUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getP2SVpnGateways() + .updateTags( + "rg1", + "p2sVpnGateway1", + new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PacketCapturesCreateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PacketCapturesCreateSamples.java new file mode 100644 index 0000000000000..79b1528e6cc34 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PacketCapturesCreateSamples.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.PacketCaptureInner; +import com.azure.resourcemanager.network.models.PacketCaptureFilter; +import com.azure.resourcemanager.network.models.PacketCaptureStorageLocation; +import com.azure.resourcemanager.network.models.PcProtocol; +import java.util.Arrays; + +/** Samples for PacketCaptures Create. */ +public final class PacketCapturesCreateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherPacketCaptureCreate.json + */ + /** + * Sample code: Create packet capture. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createPacketCapture(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPacketCaptures() + .create( + "rg1", + "nw1", + "pc1", + new PacketCaptureInner() + .withTarget( + "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Compute/virtualMachines/vm1") + .withBytesToCapturePerPacket(10000L) + .withTotalBytesPerSession(100000L) + .withTimeLimitInSeconds(100) + .withStorageLocation( + new PacketCaptureStorageLocation() + .withStorageId( + "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Storage/storageAccounts/pcstore") + .withStoragePath("https://mytestaccountname.blob.core.windows.net/capture/pc1.cap") + .withFilePath("D:\\capture\\pc1.cap")) + .withFilters( + Arrays + .asList( + new PacketCaptureFilter() + .withProtocol(PcProtocol.TCP) + .withLocalIpAddress("10.0.0.4") + .withLocalPort("80"))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PacketCapturesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PacketCapturesDeleteSamples.java new file mode 100644 index 0000000000000..7406b305b5685 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PacketCapturesDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PacketCaptures Delete. */ +public final class PacketCapturesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherPacketCaptureDelete.json + */ + /** + * Sample code: Delete packet capture. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deletePacketCapture(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getPacketCaptures().delete("rg1", "nw1", "pc1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PacketCapturesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PacketCapturesGetSamples.java new file mode 100644 index 0000000000000..5ee4e1fd77e0e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PacketCapturesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PacketCaptures Get. */ +public final class PacketCapturesGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherPacketCaptureGet.json + */ + /** + * Sample code: Get packet capture. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getPacketCapture(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPacketCaptures() + .getWithResponse("rg1", "nw1", "pc1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PacketCapturesGetStatusSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PacketCapturesGetStatusSamples.java new file mode 100644 index 0000000000000..11c3b8bf5886c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PacketCapturesGetStatusSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PacketCaptures GetStatus. */ +public final class PacketCapturesGetStatusSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherPacketCaptureQueryStatus.json + */ + /** + * Sample code: Query packet capture status. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void queryPacketCaptureStatus(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getPacketCaptures().getStatus("rg1", "nw1", "pc1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PacketCapturesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PacketCapturesListSamples.java new file mode 100644 index 0000000000000..94c9498174efd --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PacketCapturesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PacketCaptures List. */ +public final class PacketCapturesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherPacketCapturesList.json + */ + /** + * Sample code: List packet captures. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listPacketCaptures(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getPacketCaptures().list("rg1", "nw1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PacketCapturesStopSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PacketCapturesStopSamples.java new file mode 100644 index 0000000000000..10e9fa704faa0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PacketCapturesStopSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PacketCaptures Stop. */ +public final class PacketCapturesStopSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkWatcherPacketCaptureStop.json + */ + /** + * Sample code: Stop packet capture. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void stopPacketCapture(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getPacketCaptures().stop("rg1", "nw1", "pc1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PeerExpressRouteCircuitConnectionsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PeerExpressRouteCircuitConnectionsGetSamples.java new file mode 100644 index 0000000000000..4fcc83d872752 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PeerExpressRouteCircuitConnectionsGetSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PeerExpressRouteCircuitConnections Get. */ +public final class PeerExpressRouteCircuitConnectionsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PeerExpressRouteCircuitConnectionGet.json + */ + /** + * Sample code: PeerExpressRouteCircuitConnectionGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void peerExpressRouteCircuitConnectionGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPeerExpressRouteCircuitConnections() + .getWithResponse( + "rg1", + "ExpressRouteARMCircuitA", + "AzurePrivatePeering", + "60aee347-e889-4a42-8c1b-0aae8b1e4013", + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PeerExpressRouteCircuitConnectionsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PeerExpressRouteCircuitConnectionsListSamples.java new file mode 100644 index 0000000000000..381c66124b63b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PeerExpressRouteCircuitConnectionsListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PeerExpressRouteCircuitConnections List. */ +public final class PeerExpressRouteCircuitConnectionsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PeerExpressRouteCircuitConnectionList.json + */ + /** + * Sample code: List Peer ExpressRouteCircuit Connection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listPeerExpressRouteCircuitConnection(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPeerExpressRouteCircuitConnections() + .list("rg1", "ExpressRouteARMCircuitA", "AzurePrivatePeering", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateDnsZoneGroupsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateDnsZoneGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..c78f37b32f757 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateDnsZoneGroupsCreateOrUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.PrivateDnsZoneGroupInner; +import com.azure.resourcemanager.network.models.PrivateDnsZoneConfig; +import java.util.Arrays; + +/** Samples for PrivateDnsZoneGroups CreateOrUpdate. */ +public final class PrivateDnsZoneGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateEndpointDnsZoneGroupCreate.json + */ + /** + * Sample code: Create private dns zone group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createPrivateDnsZoneGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPrivateDnsZoneGroups() + .createOrUpdate( + "rg1", + "testPe", + "testPdnsgroup", + new PrivateDnsZoneGroupInner() + .withPrivateDnsZoneConfigs( + Arrays + .asList( + new PrivateDnsZoneConfig() + .withPrivateDnsZoneId( + "/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateDnsZones/zone1.com"))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateDnsZoneGroupsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateDnsZoneGroupsDeleteSamples.java new file mode 100644 index 0000000000000..33de32d9c1d35 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateDnsZoneGroupsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateDnsZoneGroups Delete. */ +public final class PrivateDnsZoneGroupsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateEndpointDnsZoneGroupDelete.json + */ + /** + * Sample code: Delete private dns zone group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deletePrivateDnsZoneGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPrivateDnsZoneGroups() + .delete("rg1", "testPe", "testPdnsgroup", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateDnsZoneGroupsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateDnsZoneGroupsGetSamples.java new file mode 100644 index 0000000000000..6a8e91d2fa0cb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateDnsZoneGroupsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateDnsZoneGroups Get. */ +public final class PrivateDnsZoneGroupsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateEndpointDnsZoneGroupGet.json + */ + /** + * Sample code: Get private dns zone group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getPrivateDnsZoneGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPrivateDnsZoneGroups() + .getWithResponse("rg1", "testPe", "testPdnsgroup", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateDnsZoneGroupsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateDnsZoneGroupsListSamples.java new file mode 100644 index 0000000000000..170255118d47a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateDnsZoneGroupsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateDnsZoneGroups List. */ +public final class PrivateDnsZoneGroupsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateEndpointDnsZoneGroupList.json + */ + /** + * Sample code: List private endpoints in resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listPrivateEndpointsInResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getPrivateDnsZoneGroups().list("testPe", "rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateEndpointsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateEndpointsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..70923e5e083a3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateEndpointsCreateOrUpdateSamples.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.ApplicationSecurityGroupInner; +import com.azure.resourcemanager.network.fluent.models.PrivateEndpointInner; +import com.azure.resourcemanager.network.fluent.models.SubnetInner; +import com.azure.resourcemanager.network.models.PrivateEndpointIpConfiguration; +import com.azure.resourcemanager.network.models.PrivateLinkServiceConnection; +import java.util.Arrays; + +/** Samples for PrivateEndpoints CreateOrUpdate. */ +public final class PrivateEndpointsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateEndpointCreateWithASG.json + */ + /** + * Sample code: Create private endpoint with application security groups. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createPrivateEndpointWithApplicationSecurityGroups( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPrivateEndpoints() + .createOrUpdate( + "rg1", + "testPe", + new PrivateEndpointInner() + .withLocation("eastus2euap") + .withSubnet( + new SubnetInner() + .withId( + "/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet")) + .withPrivateLinkServiceConnections( + Arrays + .asList( + new PrivateLinkServiceConnection() + .withPrivateLinkServiceId( + "/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls") + .withGroupIds(Arrays.asList("groupIdFromResource")) + .withRequestMessage("Please approve my connection."))) + .withApplicationSecurityGroups( + Arrays + .asList( + new ApplicationSecurityGroupInner() + .withId( + "/subscriptions/subId/resourceGroups/rg1/provders/Microsoft.Network/applicationSecurityGroup/asg1"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateEndpointCreate.json + */ + /** + * Sample code: Create private endpoint. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createPrivateEndpoint(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPrivateEndpoints() + .createOrUpdate( + "rg1", + "testPe", + new PrivateEndpointInner() + .withLocation("eastus2euap") + .withSubnet( + new SubnetInner() + .withId( + "/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet")) + .withPrivateLinkServiceConnections( + Arrays + .asList( + new PrivateLinkServiceConnection() + .withPrivateLinkServiceId( + "/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls") + .withGroupIds(Arrays.asList("groupIdFromResource")) + .withRequestMessage("Please approve my connection."))) + .withIpConfigurations( + Arrays + .asList( + new PrivateEndpointIpConfiguration() + .withName("pestaticconfig") + .withGroupId("file") + .withMemberName("file") + .withPrivateIpAddress("192.168.0.6"))) + .withCustomNetworkInterfaceName("testPeNic"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateEndpointCreateForManualApproval.json + */ + /** + * Sample code: Create private endpoint with manual approval connection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createPrivateEndpointWithManualApprovalConnection( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPrivateEndpoints() + .createOrUpdate( + "rg1", + "testPe", + new PrivateEndpointInner() + .withLocation("eastus") + .withSubnet( + new SubnetInner() + .withId( + "/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet")) + .withManualPrivateLinkServiceConnections( + Arrays + .asList( + new PrivateLinkServiceConnection() + .withPrivateLinkServiceId( + "/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/privateLinkServices/testPls") + .withGroupIds(Arrays.asList("groupIdFromResource")) + .withRequestMessage("Please manually approve my connection."))) + .withIpConfigurations( + Arrays + .asList( + new PrivateEndpointIpConfiguration() + .withName("pestaticconfig") + .withGroupId("file") + .withMemberName("file") + .withPrivateIpAddress("192.168.0.5"))) + .withCustomNetworkInterfaceName("testPeNic"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateEndpointsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateEndpointsDeleteSamples.java new file mode 100644 index 0000000000000..f3c437d89473a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateEndpointsDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpoints Delete. */ +public final class PrivateEndpointsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateEndpointDelete.json + */ + /** + * Sample code: Delete private endpoint. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deletePrivateEndpoint(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getPrivateEndpoints().delete("rg1", "testPe", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateEndpointsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateEndpointsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..86c8b4c4bf3e4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateEndpointsGetByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpoints GetByResourceGroup. */ +public final class PrivateEndpointsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateEndpointGetWithASG.json + */ + /** + * Sample code: Get private endpoint with application security groups. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getPrivateEndpointWithApplicationSecurityGroups( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPrivateEndpoints() + .getByResourceGroupWithResponse("rg1", "testPe", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateEndpointGetForManualApproval.json + */ + /** + * Sample code: Get private endpoint with manual approval connection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getPrivateEndpointWithManualApprovalConnection( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPrivateEndpoints() + .getByResourceGroupWithResponse("rg1", "testPe", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateEndpointGet.json + */ + /** + * Sample code: Get private endpoint. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getPrivateEndpoint(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPrivateEndpoints() + .getByResourceGroupWithResponse("rg1", "testPe", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateEndpointsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateEndpointsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..a71940e3cb8c0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateEndpointsListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpoints ListByResourceGroup. */ +public final class PrivateEndpointsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateEndpointList.json + */ + /** + * Sample code: List private endpoints in resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listPrivateEndpointsInResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getPrivateEndpoints().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateEndpointsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateEndpointsListSamples.java new file mode 100644 index 0000000000000..7b59eed03aa01 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateEndpointsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpoints List. */ +public final class PrivateEndpointsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateEndpointListAll.json + */ + /** + * Sample code: List all private endpoints. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllPrivateEndpoints(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getPrivateEndpoints().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupSamples.java new file mode 100644 index 0000000000000..2774e993e798f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.CheckPrivateLinkServiceVisibilityRequest; + +/** Samples for PrivateLinkServices CheckPrivateLinkServiceVisibilityByResourceGroup. */ +public final class PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/CheckPrivateLinkServiceVisibilityByResourceGroup.json + */ + /** + * Sample code: Check private link service visibility. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void checkPrivateLinkServiceVisibility(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPrivateLinkServices() + .checkPrivateLinkServiceVisibilityByResourceGroup( + "westus", + "rg1", + new CheckPrivateLinkServiceVisibilityRequest() + .withPrivateLinkServiceAlias("mypls.00000000-0000-0000-0000-000000000000.azure.privatelinkservice"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesCheckPrivateLinkServiceVisibilitySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesCheckPrivateLinkServiceVisibilitySamples.java new file mode 100644 index 0000000000000..c8df738c9a76c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesCheckPrivateLinkServiceVisibilitySamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.CheckPrivateLinkServiceVisibilityRequest; + +/** Samples for PrivateLinkServices CheckPrivateLinkServiceVisibility. */ +public final class PrivateLinkServicesCheckPrivateLinkServiceVisibilitySamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/CheckPrivateLinkServiceVisibility.json + */ + /** + * Sample code: Check private link service visibility. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void checkPrivateLinkServiceVisibility(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPrivateLinkServices() + .checkPrivateLinkServiceVisibility( + "westus", + new CheckPrivateLinkServiceVisibilityRequest() + .withPrivateLinkServiceAlias("mypls.00000000-0000-0000-0000-000000000000.azure.privatelinkservice"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..3c754765f66ef --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesCreateOrUpdateSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.FrontendIpConfigurationInner; +import com.azure.resourcemanager.network.fluent.models.PrivateLinkServiceInner; +import com.azure.resourcemanager.network.fluent.models.PrivateLinkServiceIpConfigurationInner; +import com.azure.resourcemanager.network.fluent.models.SubnetInner; +import com.azure.resourcemanager.network.models.IpAllocationMethod; +import com.azure.resourcemanager.network.models.IpVersion; +import com.azure.resourcemanager.network.models.PrivateLinkServicePropertiesAutoApproval; +import com.azure.resourcemanager.network.models.PrivateLinkServicePropertiesVisibility; +import java.util.Arrays; + +/** Samples for PrivateLinkServices CreateOrUpdate. */ +public final class PrivateLinkServicesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateLinkServiceCreate.json + */ + /** + * Sample code: Create private link service. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createPrivateLinkService(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPrivateLinkServices() + .createOrUpdate( + "rg1", + "testPls", + new PrivateLinkServiceInner() + .withLocation("eastus") + .withLoadBalancerFrontendIpConfigurations( + Arrays + .asList( + new FrontendIpConfigurationInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb"))) + .withIpConfigurations( + Arrays + .asList( + new PrivateLinkServiceIpConfigurationInner() + .withName("fe-lb") + .withPrivateIpAddress("10.0.1.4") + .withPrivateIpAllocationMethod(IpAllocationMethod.STATIC) + .withSubnet( + new SubnetInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnetlb/subnets/subnetlb")) + .withPrivateIpAddressVersion(IpVersion.IPV4))) + .withVisibility( + new PrivateLinkServicePropertiesVisibility() + .withSubscriptions(Arrays.asList("subscription1", "subscription2", "subscription3"))) + .withAutoApproval( + new PrivateLinkServicePropertiesAutoApproval() + .withSubscriptions(Arrays.asList("subscription1", "subscription2"))) + .withFqdns(Arrays.asList("fqdn1", "fqdn2", "fqdn3")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesDeletePrivateEndpointConnectionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesDeletePrivateEndpointConnectionSamples.java new file mode 100644 index 0000000000000..be3b933ade474 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesDeletePrivateEndpointConnectionSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkServices DeletePrivateEndpointConnection. */ +public final class PrivateLinkServicesDeletePrivateEndpointConnectionSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateLinkServiceDeletePrivateEndpointConnection.json + */ + /** + * Sample code: delete private end point connection for a private link service. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deletePrivateEndPointConnectionForAPrivateLinkService( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPrivateLinkServices() + .deletePrivateEndpointConnection("rg1", "testPls", "testPlePeConnection", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesDeleteSamples.java new file mode 100644 index 0000000000000..a64e63a2caa94 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkServices Delete. */ +public final class PrivateLinkServicesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateLinkServiceDelete.json + */ + /** + * Sample code: Delete private link service. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deletePrivateLinkService(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getPrivateLinkServices().delete("rg1", "testPls", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..fb1e697f5871f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkServices GetByResourceGroup. */ +public final class PrivateLinkServicesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateLinkServiceGet.json + */ + /** + * Sample code: Get private link service. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getPrivateLinkService(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPrivateLinkServices() + .getByResourceGroupWithResponse("rg1", "testPls", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesGetPrivateEndpointConnectionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesGetPrivateEndpointConnectionSamples.java new file mode 100644 index 0000000000000..f15f97d1a6368 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesGetPrivateEndpointConnectionSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkServices GetPrivateEndpointConnection. */ +public final class PrivateLinkServicesGetPrivateEndpointConnectionSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateLinkServiceGetPrivateEndpointConnection.json + */ + /** + * Sample code: Get private end point connection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getPrivateEndPointConnection(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPrivateLinkServices() + .getPrivateEndpointConnectionWithResponse("rg1", "testPls", "testPlePeConnection", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesListAutoApprovedPrivateLinkServicesByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesListAutoApprovedPrivateLinkServicesByResourceGroupSamples.java new file mode 100644 index 0000000000000..de2ea23b8aa5c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesListAutoApprovedPrivateLinkServicesByResourceGroupSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkServices ListAutoApprovedPrivateLinkServicesByResourceGroup. */ +public final class PrivateLinkServicesListAutoApprovedPrivateLinkServicesByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AutoApprovedPrivateLinkServicesResourceGroupGet.json + */ + /** + * Sample code: Get list of private link service id that can be linked to a private end point with auto approved. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getListOfPrivateLinkServiceIdThatCanBeLinkedToAPrivateEndPointWithAutoApproved( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPrivateLinkServices() + .listAutoApprovedPrivateLinkServicesByResourceGroup("regionName", "rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesListAutoApprovedPrivateLinkServicesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesListAutoApprovedPrivateLinkServicesSamples.java new file mode 100644 index 0000000000000..e44580d049612 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesListAutoApprovedPrivateLinkServicesSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkServices ListAutoApprovedPrivateLinkServices. */ +public final class PrivateLinkServicesListAutoApprovedPrivateLinkServicesSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AutoApprovedPrivateLinkServicesGet.json + */ + /** + * Sample code: Get list of private link service id that can be linked to a private end point with auto approved. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getListOfPrivateLinkServiceIdThatCanBeLinkedToAPrivateEndPointWithAutoApproved( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPrivateLinkServices() + .listAutoApprovedPrivateLinkServices("regionName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..fa970bb675f78 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkServices ListByResourceGroup. */ +public final class PrivateLinkServicesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateLinkServiceList.json + */ + /** + * Sample code: List private link service in resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listPrivateLinkServiceInResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getPrivateLinkServices().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesListPrivateEndpointConnectionsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesListPrivateEndpointConnectionsSamples.java new file mode 100644 index 0000000000000..b317f51c986c1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesListPrivateEndpointConnectionsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkServices ListPrivateEndpointConnections. */ +public final class PrivateLinkServicesListPrivateEndpointConnectionsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateLinkServiceListPrivateEndpointConnection.json + */ + /** + * Sample code: List private link service in resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listPrivateLinkServiceInResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPrivateLinkServices() + .listPrivateEndpointConnections("rg1", "testPls", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesListSamples.java new file mode 100644 index 0000000000000..a6dc49e59dcfb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkServices List. */ +public final class PrivateLinkServicesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateLinkServiceListAll.json + */ + /** + * Sample code: List all private list service. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllPrivateListService(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getPrivateLinkServices().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesUpdatePrivateEndpointConnectionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesUpdatePrivateEndpointConnectionSamples.java new file mode 100644 index 0000000000000..f453d67f8ee0c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PrivateLinkServicesUpdatePrivateEndpointConnectionSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.network.models.PrivateLinkServiceConnectionState; + +/** Samples for PrivateLinkServices UpdatePrivateEndpointConnection. */ +public final class PrivateLinkServicesUpdatePrivateEndpointConnectionSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PrivateLinkServiceUpdatePrivateEndpointConnection.json + */ + /** + * Sample code: approve or reject private end point connection for a private link service. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void approveOrRejectPrivateEndPointConnectionForAPrivateLinkService( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPrivateLinkServices() + .updatePrivateEndpointConnectionWithResponse( + "rg1", + "testPls", + "testPlePeConnection", + new PrivateEndpointConnectionInner() + .withName("testPlePeConnection") + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus("Approved") + .withDescription("approved it for some reason.")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..5d997d4024860 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesCreateOrUpdateSamples.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.PublicIpAddressInner; +import com.azure.resourcemanager.network.models.IpAllocationMethod; +import com.azure.resourcemanager.network.models.IpVersion; +import com.azure.resourcemanager.network.models.PublicIpAddressDnsSettings; +import com.azure.resourcemanager.network.models.PublicIpAddressSku; +import com.azure.resourcemanager.network.models.PublicIpAddressSkuName; +import com.azure.resourcemanager.network.models.PublicIpAddressSkuTier; + +/** Samples for PublicIpAddresses CreateOrUpdate. */ +public final class PublicIpAddressesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PublicIpAddressCreateDns.json + */ + /** + * Sample code: Create public IP address DNS. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createPublicIPAddressDNS(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPublicIpAddresses() + .createOrUpdate( + "rg1", + "test-ip", + new PublicIpAddressInner() + .withLocation("eastus") + .withDnsSettings(new PublicIpAddressDnsSettings().withDomainNameLabel("dnslbl")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PublicIpAddressCreateCustomizedValues.json + */ + /** + * Sample code: Create public IP address allocation method. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createPublicIPAddressAllocationMethod(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPublicIpAddresses() + .createOrUpdate( + "rg1", + "test-ip", + new PublicIpAddressInner() + .withLocation("eastus") + .withSku( + new PublicIpAddressSku() + .withName(PublicIpAddressSkuName.STANDARD) + .withTier(PublicIpAddressSkuTier.GLOBAL)) + .withPublicIpAllocationMethod(IpAllocationMethod.STATIC) + .withPublicIpAddressVersion(IpVersion.IPV4) + .withIdleTimeoutInMinutes(10), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PublicIpAddressCreateDefaults.json + */ + /** + * Sample code: Create public IP address defaults. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createPublicIPAddressDefaults(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPublicIpAddresses() + .createOrUpdate("rg1", "test-ip", new PublicIpAddressInner().withLocation("eastus"), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesDeleteSamples.java new file mode 100644 index 0000000000000..430d4eeb7f6e6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PublicIpAddresses Delete. */ +public final class PublicIpAddressesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PublicIpAddressDelete.json + */ + /** + * Sample code: Delete public IP address. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deletePublicIPAddress(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getPublicIpAddresses().delete("rg1", "test-ip", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..884a3cd784d47 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PublicIpAddresses GetByResourceGroup. */ +public final class PublicIpAddressesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PublicIpAddressGet.json + */ + /** + * Sample code: Get public IP address. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getPublicIPAddress(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPublicIpAddresses() + .getByResourceGroupWithResponse("rg1", "testDNS-ip", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesGetCloudServicePublicIpAddressSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesGetCloudServicePublicIpAddressSamples.java new file mode 100644 index 0000000000000..323762fec16dc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesGetCloudServicePublicIpAddressSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PublicIpAddresses GetCloudServicePublicIpAddress. */ +public final class PublicIpAddressesGetCloudServicePublicIpAddressSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/CloudServicePublicIpGet.json + */ + /** + * Sample code: GetVMSSPublicIP. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVMSSPublicIP(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPublicIpAddresses() + .getCloudServicePublicIpAddressWithResponse( + "cs-tester", "cs1", "Test_VM_0", "nic1", "ip1", "pub1", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesGetVirtualMachineScaleSetPublicIpAddressSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesGetVirtualMachineScaleSetPublicIpAddressSamples.java new file mode 100644 index 0000000000000..fa36f52872376 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesGetVirtualMachineScaleSetPublicIpAddressSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PublicIpAddresses GetVirtualMachineScaleSetPublicIpAddress. */ +public final class PublicIpAddressesGetVirtualMachineScaleSetPublicIpAddressSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VmssPublicIpGet.json + */ + /** + * Sample code: GetVMSSPublicIP. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVMSSPublicIP(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPublicIpAddresses() + .getVirtualMachineScaleSetPublicIpAddressWithResponse( + "vmss-tester", "vmss1", "1", "nic1", "ip1", "pub1", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..90b77d3bec09f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PublicIpAddresses ListByResourceGroup. */ +public final class PublicIpAddressesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PublicIpAddressList.json + */ + /** + * Sample code: List resource group public IP addresses. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listResourceGroupPublicIPAddresses(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getPublicIpAddresses().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesListCloudServicePublicIpAddressesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesListCloudServicePublicIpAddressesSamples.java new file mode 100644 index 0000000000000..fc846fc2bf176 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesListCloudServicePublicIpAddressesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PublicIpAddresses ListCloudServicePublicIpAddresses. */ +public final class PublicIpAddressesListCloudServicePublicIpAddressesSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/CloudServicePublicIpListAll.json + */ + /** + * Sample code: ListVMSSPublicIP. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listVMSSPublicIP(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPublicIpAddresses() + .listCloudServicePublicIpAddresses("cs-tester", "cs1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesListCloudServiceRoleInstancePublicIpAddressesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesListCloudServiceRoleInstancePublicIpAddressesSamples.java new file mode 100644 index 0000000000000..5f745ee76324f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesListCloudServiceRoleInstancePublicIpAddressesSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PublicIpAddresses ListCloudServiceRoleInstancePublicIpAddresses. */ +public final class PublicIpAddressesListCloudServiceRoleInstancePublicIpAddressesSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/CloudServiceRoleInstancePublicIpList.json + */ + /** + * Sample code: ListVMSSVMPublicIP. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listVMSSVMPublicIP(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPublicIpAddresses() + .listCloudServiceRoleInstancePublicIpAddresses( + "cs-tester", "cs1", "Test_VM_0", "nic1", "ip1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesListSamples.java new file mode 100644 index 0000000000000..4b0cf64e69b98 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PublicIpAddresses List. */ +public final class PublicIpAddressesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PublicIpAddressListAll.json + */ + /** + * Sample code: List all public IP addresses. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllPublicIPAddresses(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getPublicIpAddresses().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesListVirtualMachineScaleSetPublicIpAddressesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesListVirtualMachineScaleSetPublicIpAddressesSamples.java new file mode 100644 index 0000000000000..89b15982f14a5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesListVirtualMachineScaleSetPublicIpAddressesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PublicIpAddresses ListVirtualMachineScaleSetPublicIpAddresses. */ +public final class PublicIpAddressesListVirtualMachineScaleSetPublicIpAddressesSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VmssPublicIpListAll.json + */ + /** + * Sample code: ListVMSSPublicIP. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listVMSSPublicIP(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPublicIpAddresses() + .listVirtualMachineScaleSetPublicIpAddresses("vmss-tester", "vmss1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesListVirtualMachineScaleSetVMPublicIpAddressesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesListVirtualMachineScaleSetVMPublicIpAddressesSamples.java new file mode 100644 index 0000000000000..d0683a5c46e80 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesListVirtualMachineScaleSetVMPublicIpAddressesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PublicIpAddresses ListVirtualMachineScaleSetVMPublicIpAddresses. */ +public final class PublicIpAddressesListVirtualMachineScaleSetVMPublicIpAddressesSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VmssVmPublicIpList.json + */ + /** + * Sample code: ListVMSSVMPublicIP. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listVMSSVMPublicIP(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPublicIpAddresses() + .listVirtualMachineScaleSetVMPublicIpAddresses("vmss-tester", "vmss1", "1", "nic1", "ip1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesUpdateTagsSamples.java new file mode 100644 index 0000000000000..d84c03ba37130 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpAddressesUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for PublicIpAddresses UpdateTags. */ +public final class PublicIpAddressesUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PublicIpAddressUpdateTags.json + */ + /** + * Sample code: Update public IP address tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updatePublicIPAddressTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPublicIpAddresses() + .updateTagsWithResponse( + "rg1", "test-ip", new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpPrefixesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpPrefixesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..bf6d8f2298e24 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpPrefixesCreateOrUpdateSamples.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.PublicIpPrefixInner; +import com.azure.resourcemanager.network.models.IpVersion; +import com.azure.resourcemanager.network.models.PublicIpPrefixSku; +import com.azure.resourcemanager.network.models.PublicIpPrefixSkuName; +import com.azure.resourcemanager.network.models.PublicIpPrefixSkuTier; + +/** Samples for PublicIpPrefixes CreateOrUpdate. */ +public final class PublicIpPrefixesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PublicIpPrefixCreateDefaults.json + */ + /** + * Sample code: Create public IP prefix defaults. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createPublicIPPrefixDefaults(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPublicIpPrefixes() + .createOrUpdate( + "rg1", + "test-ipprefix", + new PublicIpPrefixInner() + .withLocation("westus") + .withSku(new PublicIpPrefixSku().withName(PublicIpPrefixSkuName.STANDARD)) + .withPrefixLength(30), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PublicIpPrefixCreateCustomizedValues.json + */ + /** + * Sample code: Create public IP prefix allocation method. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createPublicIPPrefixAllocationMethod(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPublicIpPrefixes() + .createOrUpdate( + "rg1", + "test-ipprefix", + new PublicIpPrefixInner() + .withLocation("westus") + .withSku( + new PublicIpPrefixSku() + .withName(PublicIpPrefixSkuName.STANDARD) + .withTier(PublicIpPrefixSkuTier.REGIONAL)) + .withPublicIpAddressVersion(IpVersion.IPV4) + .withPrefixLength(30), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpPrefixesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpPrefixesDeleteSamples.java new file mode 100644 index 0000000000000..30c4e87f21509 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpPrefixesDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PublicIpPrefixes Delete. */ +public final class PublicIpPrefixesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PublicIpPrefixDelete.json + */ + /** + * Sample code: Delete public IP prefix. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deletePublicIPPrefix(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getPublicIpPrefixes().delete("rg1", "test-ipprefix", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpPrefixesGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpPrefixesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..3f4df8020b16f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpPrefixesGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PublicIpPrefixes GetByResourceGroup. */ +public final class PublicIpPrefixesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PublicIpPrefixGet.json + */ + /** + * Sample code: Get public IP prefix. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getPublicIPPrefix(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPublicIpPrefixes() + .getByResourceGroupWithResponse("rg1", "test-ipprefix", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpPrefixesListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpPrefixesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..4dfd1f87426a5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpPrefixesListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PublicIpPrefixes ListByResourceGroup. */ +public final class PublicIpPrefixesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PublicIpPrefixList.json + */ + /** + * Sample code: List resource group public IP prefixes. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listResourceGroupPublicIPPrefixes(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getPublicIpPrefixes().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpPrefixesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpPrefixesListSamples.java new file mode 100644 index 0000000000000..e369b81a3ea5e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpPrefixesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for PublicIpPrefixes List. */ +public final class PublicIpPrefixesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PublicIpPrefixListAll.json + */ + /** + * Sample code: List all public IP prefixes. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllPublicIPPrefixes(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getPublicIpPrefixes().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpPrefixesUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpPrefixesUpdateTagsSamples.java new file mode 100644 index 0000000000000..75637d8ed2e86 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/PublicIpPrefixesUpdateTagsSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for PublicIpPrefixes UpdateTags. */ +public final class PublicIpPrefixesUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/PublicIpPrefixUpdateTags.json + */ + /** + * Sample code: Update public IP prefix tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updatePublicIPPrefixTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getPublicIpPrefixes() + .updateTagsWithResponse( + "rg1", + "test-ipprefix", + new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ResourceNavigationLinksListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ResourceNavigationLinksListSamples.java new file mode 100644 index 0000000000000..36b09f1763f6d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ResourceNavigationLinksListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ResourceNavigationLinks List. */ +public final class ResourceNavigationLinksListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGetResourceNavigationLinks.json + */ + /** + * Sample code: Get Resource Navigation Links. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getResourceNavigationLinks(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getResourceNavigationLinks() + .listWithResponse("rg1", "vnet", "subnet", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFilterRulesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFilterRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..3c2abee093fbc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFilterRulesCreateOrUpdateSamples.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.RouteFilterRuleInner; +import com.azure.resourcemanager.network.models.Access; +import com.azure.resourcemanager.network.models.RouteFilterRuleType; +import java.util.Arrays; + +/** Samples for RouteFilterRules CreateOrUpdate. */ +public final class RouteFilterRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RouteFilterRuleCreate.json + */ + /** + * Sample code: RouteFilterRuleCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void routeFilterRuleCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getRouteFilterRules() + .createOrUpdate( + "rg1", + "filterName", + "ruleName", + new RouteFilterRuleInner() + .withAccess(Access.ALLOW) + .withRouteFilterRuleType(RouteFilterRuleType.COMMUNITY) + .withCommunities(Arrays.asList("12076:5030", "12076:5040")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFilterRulesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFilterRulesDeleteSamples.java new file mode 100644 index 0000000000000..42d1601e40e8c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFilterRulesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for RouteFilterRules Delete. */ +public final class RouteFilterRulesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RouteFilterRuleDelete.json + */ + /** + * Sample code: RouteFilterRuleDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void routeFilterRuleDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getRouteFilterRules() + .delete("rg1", "filterName", "ruleName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFilterRulesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFilterRulesGetSamples.java new file mode 100644 index 0000000000000..9001393951bf2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFilterRulesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for RouteFilterRules Get. */ +public final class RouteFilterRulesGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RouteFilterRuleGet.json + */ + /** + * Sample code: RouteFilterRuleGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void routeFilterRuleGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getRouteFilterRules() + .getWithResponse("rg1", "filterName", "filterName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFilterRulesListByRouteFilterSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFilterRulesListByRouteFilterSamples.java new file mode 100644 index 0000000000000..d193a8bf0cfec --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFilterRulesListByRouteFilterSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for RouteFilterRules ListByRouteFilter. */ +public final class RouteFilterRulesListByRouteFilterSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RouteFilterRuleListByRouteFilter.json + */ + /** + * Sample code: RouteFilterRuleListByRouteFilter. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void routeFilterRuleListByRouteFilter(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getRouteFilterRules() + .listByRouteFilter("rg1", "filterName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFiltersCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFiltersCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..f266b108c4b0f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFiltersCreateOrUpdateSamples.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.RouteFilterInner; +import com.azure.resourcemanager.network.fluent.models.RouteFilterRuleInner; +import com.azure.resourcemanager.network.models.Access; +import com.azure.resourcemanager.network.models.RouteFilterRuleType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for RouteFilters CreateOrUpdate. */ +public final class RouteFiltersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RouteFilterCreate.json + */ + /** + * Sample code: RouteFilterCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void routeFilterCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getRouteFilters() + .createOrUpdate( + "rg1", + "filterName", + new RouteFilterInner() + .withLocation("West US") + .withTags(mapOf("key1", "value1")) + .withRules( + Arrays + .asList( + new RouteFilterRuleInner() + .withName("ruleName") + .withAccess(Access.ALLOW) + .withRouteFilterRuleType(RouteFilterRuleType.COMMUNITY) + .withCommunities(Arrays.asList("12076:5030", "12076:5040")))), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFiltersDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFiltersDeleteSamples.java new file mode 100644 index 0000000000000..33b4fdd9fe1f8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFiltersDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for RouteFilters Delete. */ +public final class RouteFiltersDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RouteFilterDelete.json + */ + /** + * Sample code: RouteFilterDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void routeFilterDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getRouteFilters().delete("rg1", "filterName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFiltersGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFiltersGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..15e31f6cfa71f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFiltersGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for RouteFilters GetByResourceGroup. */ +public final class RouteFiltersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RouteFilterGet.json + */ + /** + * Sample code: RouteFilterGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void routeFilterGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getRouteFilters() + .getByResourceGroupWithResponse("rg1", "filterName", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFiltersListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFiltersListByResourceGroupSamples.java new file mode 100644 index 0000000000000..a0a91106f8037 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFiltersListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for RouteFilters ListByResourceGroup. */ +public final class RouteFiltersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RouteFilterListByResourceGroup.json + */ + /** + * Sample code: RouteFilterListByResourceGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void routeFilterListByResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getRouteFilters().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFiltersListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFiltersListSamples.java new file mode 100644 index 0000000000000..aa32ae3db8b59 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFiltersListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for RouteFilters List. */ +public final class RouteFiltersListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RouteFilterList.json + */ + /** + * Sample code: RouteFilterList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void routeFilterList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getRouteFilters().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFiltersUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFiltersUpdateTagsSamples.java new file mode 100644 index 0000000000000..52411efc13afb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteFiltersUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for RouteFilters UpdateTags. */ +public final class RouteFiltersUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RouteFilterUpdateTags.json + */ + /** + * Sample code: Update route filter tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateRouteFilterTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getRouteFilters() + .updateTagsWithResponse( + "rg1", "filterName", new TagsObject().withTags(mapOf("key1", "value1")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteTablesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteTablesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..8f9b322105291 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteTablesCreateOrUpdateSamples.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.RouteInner; +import com.azure.resourcemanager.network.fluent.models.RouteTableInner; +import com.azure.resourcemanager.network.models.RouteNextHopType; +import java.util.Arrays; + +/** Samples for RouteTables CreateOrUpdate. */ +public final class RouteTablesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RouteTableCreate.json + */ + /** + * Sample code: Create route table. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createRouteTable(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getRouteTables() + .createOrUpdate("rg1", "testrt", new RouteTableInner().withLocation("westus"), Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RouteTableCreateWithRoute.json + */ + /** + * Sample code: Create route table with route. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createRouteTableWithRoute(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getRouteTables() + .createOrUpdate( + "rg1", + "testrt", + new RouteTableInner() + .withLocation("westus") + .withRoutes( + Arrays + .asList( + new RouteInner() + .withName("route1") + .withAddressPrefix("10.0.3.0/24") + .withNextHopType(RouteNextHopType.VIRTUAL_NETWORK_GATEWAY))) + .withDisableBgpRoutePropagation(true), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteTablesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteTablesDeleteSamples.java new file mode 100644 index 0000000000000..502fa7476754d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteTablesDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for RouteTables Delete. */ +public final class RouteTablesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RouteTableDelete.json + */ + /** + * Sample code: Delete route table. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteRouteTable(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getRouteTables().delete("rg1", "testrt", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteTablesGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteTablesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..4bb76928be640 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteTablesGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for RouteTables GetByResourceGroup. */ +public final class RouteTablesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RouteTableGet.json + */ + /** + * Sample code: Get route table. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getRouteTable(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getRouteTables() + .getByResourceGroupWithResponse("rg1", "testrt", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteTablesListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteTablesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..3951400aa8da3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteTablesListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for RouteTables ListByResourceGroup. */ +public final class RouteTablesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RouteTableList.json + */ + /** + * Sample code: List route tables in resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listRouteTablesInResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getRouteTables().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteTablesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteTablesListSamples.java new file mode 100644 index 0000000000000..4fd51f676b1e9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteTablesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for RouteTables List. */ +public final class RouteTablesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RouteTableListAll.json + */ + /** + * Sample code: List all route tables. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllRouteTables(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getRouteTables().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteTablesUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteTablesUpdateTagsSamples.java new file mode 100644 index 0000000000000..d4f5a9780175c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RouteTablesUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for RouteTables UpdateTags. */ +public final class RouteTablesUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RouteTableUpdateTags.json + */ + /** + * Sample code: Update route table tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateRouteTableTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getRouteTables() + .updateTagsWithResponse( + "rg1", "testrt", new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..dbe2f6720ecba --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutesCreateOrUpdateSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.RouteInner; +import com.azure.resourcemanager.network.models.RouteNextHopType; + +/** Samples for Routes CreateOrUpdate. */ +public final class RoutesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RouteTableRouteCreate.json + */ + /** + * Sample code: Create route. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createRoute(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getRoutes() + .createOrUpdate( + "rg1", + "testrt", + "route1", + new RouteInner() + .withAddressPrefix("10.0.3.0/24") + .withNextHopType(RouteNextHopType.VIRTUAL_NETWORK_GATEWAY), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutesDeleteSamples.java new file mode 100644 index 0000000000000..61307f1cec53e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutesDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for Routes Delete. */ +public final class RoutesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RouteTableRouteDelete.json + */ + /** + * Sample code: Delete route. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteRoute(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getRoutes().delete("rg1", "testrt", "route1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutesGetSamples.java new file mode 100644 index 0000000000000..632649b68a8f0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutesGetSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for Routes Get. */ +public final class RoutesGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RouteTableRouteGet.json + */ + /** + * Sample code: Get route. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getRoute(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getRoutes().getWithResponse("rg1", "testrt", "route1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutesListSamples.java new file mode 100644 index 0000000000000..7ae9008b5b32a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for Routes List. */ +public final class RoutesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RouteTableRouteList.json + */ + /** + * Sample code: List routes. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listRoutes(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getRoutes().list("rg1", "testrt", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutingIntentCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutingIntentCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..73189c84d83f9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutingIntentCreateOrUpdateSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.RoutingIntentInner; +import com.azure.resourcemanager.network.models.RoutingPolicy; +import java.util.Arrays; + +/** Samples for RoutingIntent CreateOrUpdate. */ +public final class RoutingIntentCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RoutingIntentPut.json + */ + /** + * Sample code: RouteTablePut. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void routeTablePut(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getRoutingIntents() + .createOrUpdate( + "rg1", + "virtualHub1", + "Intent1", + new RoutingIntentInner() + .withRoutingPolicies( + Arrays + .asList( + new RoutingPolicy() + .withName("InternetTraffic") + .withDestinations(Arrays.asList("Internet")) + .withNextHop( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azfw1"), + new RoutingPolicy() + .withName("PrivateTrafficPolicy") + .withDestinations(Arrays.asList("PrivateTraffic")) + .withNextHop( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/azureFirewalls/azfw1"))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutingIntentDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutingIntentDeleteSamples.java new file mode 100644 index 0000000000000..7fa76364ec5b2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutingIntentDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for RoutingIntent Delete. */ +public final class RoutingIntentDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RoutingIntentDelete.json + */ + /** + * Sample code: RouteTableDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void routeTableDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getRoutingIntents() + .delete("rg1", "virtualHub1", "Intent1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutingIntentGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutingIntentGetSamples.java new file mode 100644 index 0000000000000..e239ad80bf3a1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutingIntentGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for RoutingIntent Get. */ +public final class RoutingIntentGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RoutingIntentGet.json + */ + /** + * Sample code: RouteTableGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void routeTableGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getRoutingIntents() + .getWithResponse("rg1", "virtualHub1", "Intent1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutingIntentListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutingIntentListSamples.java new file mode 100644 index 0000000000000..3d852ad08ddd8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/RoutingIntentListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for RoutingIntent List. */ +public final class RoutingIntentListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/RoutingIntentList.json + */ + /** + * Sample code: RoutingIntentList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void routingIntentList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getRoutingIntents().list("rg1", "virtualHub1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityPartnerProvidersCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityPartnerProvidersCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..8a22e9493e222 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityPartnerProvidersCreateOrUpdateSamples.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.SecurityPartnerProviderInner; +import com.azure.resourcemanager.network.models.SecurityProviderName; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SecurityPartnerProviders CreateOrUpdate. */ +public final class SecurityPartnerProvidersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/SecurityPartnerProviderPut.json + */ + /** + * Sample code: Create Security Partner Provider. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createSecurityPartnerProvider(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getSecurityPartnerProviders() + .createOrUpdate( + "rg1", + "securityPartnerProvider", + new SecurityPartnerProviderInner() + .withLocation("West US") + .withTags(mapOf("key1", "value1")) + .withSecurityProviderName(SecurityProviderName.ZSCALER) + .withVirtualHub( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityPartnerProvidersDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityPartnerProvidersDeleteSamples.java new file mode 100644 index 0000000000000..475420a14eaf1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityPartnerProvidersDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for SecurityPartnerProviders Delete. */ +public final class SecurityPartnerProvidersDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/SecurityPartnerProviderDelete.json + */ + /** + * Sample code: Delete Security Partner Provider. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteSecurityPartnerProvider(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getSecurityPartnerProviders() + .delete("rg1", "securityPartnerProvider", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityPartnerProvidersGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityPartnerProvidersGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..6b388147dae8a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityPartnerProvidersGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for SecurityPartnerProviders GetByResourceGroup. */ +public final class SecurityPartnerProvidersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/SecurityPartnerProviderGet.json + */ + /** + * Sample code: Get Security Partner Provider. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getSecurityPartnerProvider(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getSecurityPartnerProviders() + .getByResourceGroupWithResponse("rg1", "securityPartnerProvider", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityPartnerProvidersListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityPartnerProvidersListByResourceGroupSamples.java new file mode 100644 index 0000000000000..75502eca01c46 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityPartnerProvidersListByResourceGroupSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for SecurityPartnerProviders ListByResourceGroup. */ +public final class SecurityPartnerProvidersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/SecurityPartnerProviderListByResourceGroup.json + */ + /** + * Sample code: List all Security Partner Providers for a given resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllSecurityPartnerProvidersForAGivenResourceGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getSecurityPartnerProviders() + .listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityPartnerProvidersListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityPartnerProvidersListSamples.java new file mode 100644 index 0000000000000..3f8fe06b7a650 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityPartnerProvidersListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for SecurityPartnerProviders List. */ +public final class SecurityPartnerProvidersListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/SecurityPartnerProviderListBySubscription.json + */ + /** + * Sample code: List all Security Partner Providers for a given subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllSecurityPartnerProvidersForAGivenSubscription( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getSecurityPartnerProviders().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityPartnerProvidersUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityPartnerProvidersUpdateTagsSamples.java new file mode 100644 index 0000000000000..7d739366d752e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityPartnerProvidersUpdateTagsSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SecurityPartnerProviders UpdateTags. */ +public final class SecurityPartnerProvidersUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/SecurityPartnerProviderUpdateTags.json + */ + /** + * Sample code: Update Security Partner Provider Tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateSecurityPartnerProviderTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getSecurityPartnerProviders() + .updateTagsWithResponse( + "rg1", + "securityPartnerProvider", + new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityRulesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..bda66c2464d8f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityRulesCreateOrUpdateSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.SecurityRuleInner; +import com.azure.resourcemanager.network.models.SecurityRuleAccess; +import com.azure.resourcemanager.network.models.SecurityRuleDirection; +import com.azure.resourcemanager.network.models.SecurityRuleProtocol; + +/** Samples for SecurityRules CreateOrUpdate. */ +public final class SecurityRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkSecurityGroupRuleCreate.json + */ + /** + * Sample code: Create security rule. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createSecurityRule(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getSecurityRules() + .createOrUpdate( + "rg1", + "testnsg", + "rule1", + new SecurityRuleInner() + .withProtocol(SecurityRuleProtocol.ASTERISK) + .withSourcePortRange("*") + .withDestinationPortRange("8080") + .withSourceAddressPrefix("10.0.0.0/8") + .withDestinationAddressPrefix("11.0.0.0/8") + .withAccess(SecurityRuleAccess.DENY) + .withPriority(100) + .withDirection(SecurityRuleDirection.OUTBOUND), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityRulesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityRulesDeleteSamples.java new file mode 100644 index 0000000000000..81d0e49a0b139 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityRulesDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for SecurityRules Delete. */ +public final class SecurityRulesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkSecurityGroupRuleDelete.json + */ + /** + * Sample code: Delete network security rule from network security group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteNetworkSecurityRuleFromNetworkSecurityGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getSecurityRules().delete("rg1", "testnsg", "rule1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityRulesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityRulesGetSamples.java new file mode 100644 index 0000000000000..989abb90c77ad --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityRulesGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for SecurityRules Get. */ +public final class SecurityRulesGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkSecurityGroupRuleGet.json + */ + /** + * Sample code: Get network security rule in network security group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getNetworkSecurityRuleInNetworkSecurityGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getSecurityRules() + .getWithResponse("rg1", "testnsg", "rule1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityRulesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityRulesListSamples.java new file mode 100644 index 0000000000000..59d49036f6450 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SecurityRulesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for SecurityRules List. */ +public final class SecurityRulesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkSecurityGroupRuleList.json + */ + /** + * Sample code: List network security rules in network security group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listNetworkSecurityRulesInNetworkSecurityGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getSecurityRules().list("rg1", "testnsg", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceAssociationLinksListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceAssociationLinksListSamples.java new file mode 100644 index 0000000000000..dad3df068c0dd --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceAssociationLinksListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ServiceAssociationLinks List. */ +public final class ServiceAssociationLinksListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGetServiceAssociationLinks.json + */ + /** + * Sample code: Get Service Association Links. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getServiceAssociationLinks(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getServiceAssociationLinks() + .listWithResponse("rg1", "vnet", "subnet", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPoliciesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..4610e894a11ee --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.ServiceEndpointPolicyDefinitionInner; +import com.azure.resourcemanager.network.fluent.models.ServiceEndpointPolicyInner; +import java.util.Arrays; + +/** Samples for ServiceEndpointPolicies CreateOrUpdate. */ +public final class ServiceEndpointPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ServiceEndpointPolicyCreate.json + */ + /** + * Sample code: Create service endpoint policy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createServiceEndpointPolicy(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getServiceEndpointPolicies() + .createOrUpdate("rg1", "testPolicy", new ServiceEndpointPolicyInner().withLocation("westus"), Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ServiceEndpointPolicyCreateWithDefinition.json + */ + /** + * Sample code: Create service endpoint policy with definition. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createServiceEndpointPolicyWithDefinition(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getServiceEndpointPolicies() + .createOrUpdate( + "rg1", + "testPolicy", + new ServiceEndpointPolicyInner() + .withLocation("westus") + .withServiceEndpointPolicyDefinitions( + Arrays + .asList( + new ServiceEndpointPolicyDefinitionInner() + .withName("StorageServiceEndpointPolicyDefinition") + .withDescription("Storage Service EndpointPolicy Definition") + .withService("Microsoft.Storage") + .withServiceResources( + Arrays + .asList( + "/subscriptions/subid1", + "/subscriptions/subid1/resourceGroups/storageRg", + "/subscriptions/subid1/resourceGroups/storageRg/providers/Microsoft.Storage/storageAccounts/stAccount")))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPoliciesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPoliciesDeleteSamples.java new file mode 100644 index 0000000000000..b224dc9ea69d0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPoliciesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ServiceEndpointPolicies Delete. */ +public final class ServiceEndpointPoliciesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ServiceEndpointPolicyDelete.json + */ + /** + * Sample code: Delete service endpoint policy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteServiceEndpointPolicy(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getServiceEndpointPolicies() + .delete("rg1", "serviceEndpointPolicy1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPoliciesGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPoliciesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..9102a5d88f1cc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPoliciesGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ServiceEndpointPolicies GetByResourceGroup. */ +public final class ServiceEndpointPoliciesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ServiceEndpointPolicyGet.json + */ + /** + * Sample code: Get service endPoint Policy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getServiceEndPointPolicy(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getServiceEndpointPolicies() + .getByResourceGroupWithResponse("rg1", "testServiceEndpointPolicy", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPoliciesListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPoliciesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..44a5afb6f0cf9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPoliciesListByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ServiceEndpointPolicies ListByResourceGroup. */ +public final class ServiceEndpointPoliciesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ServiceEndpointPolicyList.json + */ + /** + * Sample code: List resource group service endpoint policies. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listResourceGroupServiceEndpointPolicies(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getServiceEndpointPolicies() + .listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPoliciesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPoliciesListSamples.java new file mode 100644 index 0000000000000..76da2d8c473cc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPoliciesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ServiceEndpointPolicies List. */ +public final class ServiceEndpointPoliciesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ServiceEndpointPolicyListAll.json + */ + /** + * Sample code: List all service endpoint policy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllServiceEndpointPolicy(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getServiceEndpointPolicies().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPoliciesUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPoliciesUpdateTagsSamples.java new file mode 100644 index 0000000000000..74aa3db46388a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPoliciesUpdateTagsSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ServiceEndpointPolicies UpdateTags. */ +public final class ServiceEndpointPoliciesUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ServiceEndpointPolicyUpdateTags.json + */ + /** + * Sample code: Update service endpoint policy tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateServiceEndpointPolicyTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getServiceEndpointPolicies() + .updateTagsWithResponse( + "rg1", + "testServiceEndpointPolicy", + new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPolicyDefinitionsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPolicyDefinitionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..52a8674f169ca --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPolicyDefinitionsCreateOrUpdateSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.ServiceEndpointPolicyDefinitionInner; +import java.util.Arrays; + +/** Samples for ServiceEndpointPolicyDefinitions CreateOrUpdate. */ +public final class ServiceEndpointPolicyDefinitionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ServiceEndpointPolicyDefinitionCreate.json + */ + /** + * Sample code: Create service endpoint policy definition. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createServiceEndpointPolicyDefinition(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getServiceEndpointPolicyDefinitions() + .createOrUpdate( + "rg1", + "testPolicy", + "testDefinition", + new ServiceEndpointPolicyDefinitionInner() + .withDescription("Storage Service EndpointPolicy Definition") + .withService("Microsoft.Storage") + .withServiceResources( + Arrays + .asList( + "/subscriptions/subid1", + "/subscriptions/subid1/resourceGroups/storageRg", + "/subscriptions/subid1/resourceGroups/storageRg/providers/Microsoft.Storage/storageAccounts/stAccount")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPolicyDefinitionsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPolicyDefinitionsDeleteSamples.java new file mode 100644 index 0000000000000..912793c0aef68 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPolicyDefinitionsDeleteSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ServiceEndpointPolicyDefinitions Delete. */ +public final class ServiceEndpointPolicyDefinitionsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ServiceEndpointPolicyDefinitionDelete.json + */ + /** + * Sample code: Delete service endpoint policy definitions from service endpoint policy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteServiceEndpointPolicyDefinitionsFromServiceEndpointPolicy( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getServiceEndpointPolicyDefinitions() + .delete("rg1", "testPolicy", "testDefinition", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPolicyDefinitionsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPolicyDefinitionsGetSamples.java new file mode 100644 index 0000000000000..83964952d9eb0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPolicyDefinitionsGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ServiceEndpointPolicyDefinitions Get. */ +public final class ServiceEndpointPolicyDefinitionsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ServiceEndpointPolicyDefinitionGet.json + */ + /** + * Sample code: Get service endpoint definition in service endpoint policy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getServiceEndpointDefinitionInServiceEndpointPolicy( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getServiceEndpointPolicyDefinitions() + .getWithResponse("rg1", "testPolicy", "testDefinition", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPolicyDefinitionsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPolicyDefinitionsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..0c432aa387804 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceEndpointPolicyDefinitionsListByResourceGroupSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ServiceEndpointPolicyDefinitions ListByResourceGroup. */ +public final class ServiceEndpointPolicyDefinitionsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ServiceEndpointPolicyDefinitionList.json + */ + /** + * Sample code: List service endpoint definitions in service end point policy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listServiceEndpointDefinitionsInServiceEndPointPolicy( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getServiceEndpointPolicyDefinitions() + .listByResourceGroup("rg1", "testPolicy", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceTagInformationListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceTagInformationListSamples.java new file mode 100644 index 0000000000000..3ec9db89ae98e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceTagInformationListSamples.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ServiceTagInformation List. */ +public final class ServiceTagInformationListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ServiceTagInformationListResultWithNoAddressPrefixes.json + */ + /** + * Sample code: Get list of service tags with no address prefixes. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getListOfServiceTagsWithNoAddressPrefixes(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getServiceTagInformations() + .list("westeurope", true, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ServiceTagInformationListResult.json + */ + /** + * Sample code: Get list of service tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getListOfServiceTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getServiceTagInformations() + .list("westeurope", null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ServiceTagInformationListResultWithTagname.json + */ + /** + * Sample code: Get list of service tags with tag name. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getListOfServiceTagsWithTagName(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getServiceTagInformations() + .list("westeurope", null, "ApiManagement", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceTagsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceTagsListSamples.java new file mode 100644 index 0000000000000..07b5ea6ef3e80 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/ServiceTagsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for ServiceTags List. */ +public final class ServiceTagsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/ServiceTagsList.json + */ + /** + * Sample code: Get list of service tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getListOfServiceTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getServiceTags().listWithResponse("westcentralus", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SubnetsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SubnetsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..ff6e77eceb714 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SubnetsCreateOrUpdateSamples.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.SubnetInner; +import com.azure.resourcemanager.network.models.ServiceEndpointPropertiesFormat; +import java.util.Arrays; + +/** Samples for Subnets CreateOrUpdate. */ +public final class SubnetsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/SubnetCreate.json + */ + /** + * Sample code: Create subnet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createSubnet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getSubnets() + .createOrUpdate( + "subnet-test", "vnetname", "subnet1", new SubnetInner().withAddressPrefix("10.0.0.0/16"), Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/SubnetCreateServiceEndpoint.json + */ + /** + * Sample code: Create subnet with service endpoints. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createSubnetWithServiceEndpoints(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getSubnets() + .createOrUpdate( + "subnet-test", + "vnetname", + "subnet1", + new SubnetInner() + .withAddressPrefix("10.0.0.0/16") + .withServiceEndpoints( + Arrays.asList(new ServiceEndpointPropertiesFormat().withService("Microsoft.Storage"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/SubnetCreateWithDelegation.json + */ + /** + * Sample code: Create subnet with a delegation. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createSubnetWithADelegation(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getSubnets() + .createOrUpdate( + "subnet-test", "vnetname", "subnet1", new SubnetInner().withAddressPrefix("10.0.0.0/16"), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SubnetsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SubnetsDeleteSamples.java new file mode 100644 index 0000000000000..286f6c4fbac0d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SubnetsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for Subnets Delete. */ +public final class SubnetsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/SubnetDelete.json + */ + /** + * Sample code: Delete subnet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteSubnet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getSubnets() + .delete("subnet-test", "vnetname", "subnet1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SubnetsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SubnetsGetSamples.java new file mode 100644 index 0000000000000..d8330a062fdb4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SubnetsGetSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for Subnets Get. */ +public final class SubnetsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/SubnetGet.json + */ + /** + * Sample code: Get subnet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getSubnet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getSubnets() + .getWithResponse("subnet-test", "vnetname", "subnet1", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/SubnetGetWithDelegation.json + */ + /** + * Sample code: Get subnet with a delegation. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getSubnetWithADelegation(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getSubnets() + .getWithResponse("subnet-test", "vnetname", "subnet1", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SubnetsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SubnetsListSamples.java new file mode 100644 index 0000000000000..79078ec0e2a66 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SubnetsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for Subnets List. */ +public final class SubnetsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/SubnetList.json + */ + /** + * Sample code: List subnets. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listSubnets(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getSubnets().list("subnet-test", "vnetname", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SubnetsPrepareNetworkPoliciesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SubnetsPrepareNetworkPoliciesSamples.java new file mode 100644 index 0000000000000..36e2d211772cc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SubnetsPrepareNetworkPoliciesSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.PrepareNetworkPoliciesRequest; + +/** Samples for Subnets PrepareNetworkPolicies. */ +public final class SubnetsPrepareNetworkPoliciesSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/SubnetPrepareNetworkPolicies.json + */ + /** + * Sample code: Prepare Network Policies. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void prepareNetworkPolicies(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getSubnets() + .prepareNetworkPolicies( + "rg1", + "test-vnet", + "subnet1", + new PrepareNetworkPoliciesRequest().withServiceName("Microsoft.Sql/managedInstances"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SubnetsUnprepareNetworkPoliciesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SubnetsUnprepareNetworkPoliciesSamples.java new file mode 100644 index 0000000000000..ab888b0960d9b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/SubnetsUnprepareNetworkPoliciesSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.UnprepareNetworkPoliciesRequest; + +/** Samples for Subnets UnprepareNetworkPolicies. */ +public final class SubnetsUnprepareNetworkPoliciesSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/SubnetUnprepareNetworkPolicies.json + */ + /** + * Sample code: Unprepare Network Policies. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void unprepareNetworkPolicies(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getSubnets() + .unprepareNetworkPolicies( + "rg1", + "test-vnet", + "subnet1", + new UnprepareNetworkPoliciesRequest().withServiceName("Microsoft.Sql/managedInstances"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/UsagesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/UsagesListSamples.java new file mode 100644 index 0000000000000..d70e67c68a8a7 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/UsagesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for Usages List. */ +public final class UsagesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/UsageList.json + */ + /** + * Sample code: List usages. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listUsages(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getUsages().list("westus", Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/UsageListSpacedLocation.json + */ + /** + * Sample code: List usages spaced location. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listUsagesSpacedLocation(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getUsages().list("West US", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualApplianceSitesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualApplianceSitesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..5f73d2362c0d3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualApplianceSitesCreateOrUpdateSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.VirtualApplianceSiteInner; +import com.azure.resourcemanager.network.models.BreakOutCategoryPolicies; +import com.azure.resourcemanager.network.models.Office365PolicyProperties; + +/** Samples for VirtualApplianceSites CreateOrUpdate. */ +public final class VirtualApplianceSitesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkVirtualApplianceSitePut.json + */ + /** + * Sample code: Create Network Virtual Appliance Site. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createNetworkVirtualApplianceSite(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualApplianceSites() + .createOrUpdate( + "rg1", + "nva", + "site1", + new VirtualApplianceSiteInner() + .withAddressPrefix("192.168.1.0/24") + .withO365Policy( + new Office365PolicyProperties() + .withBreakOutCategories( + new BreakOutCategoryPolicies() + .withAllow(true) + .withOptimize(true) + .withDefaultProperty(true))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualApplianceSitesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualApplianceSitesDeleteSamples.java new file mode 100644 index 0000000000000..d25843125eca0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualApplianceSitesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualApplianceSites Delete. */ +public final class VirtualApplianceSitesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkVirtualApplianceSiteDelete.json + */ + /** + * Sample code: Delete Network Virtual Appliance Site. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteNetworkVirtualApplianceSite(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualApplianceSites() + .delete("rg1", "nva", "site1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualApplianceSitesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualApplianceSitesGetSamples.java new file mode 100644 index 0000000000000..7046be39e93f1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualApplianceSitesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualApplianceSites Get. */ +public final class VirtualApplianceSitesGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkVirtualApplianceSiteGet.json + */ + /** + * Sample code: GetNetwork Virtual Appliance Site. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getNetworkVirtualApplianceSite(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualApplianceSites() + .getWithResponse("rg1", "nva", "site1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualApplianceSitesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualApplianceSitesListSamples.java new file mode 100644 index 0000000000000..b435e96318474 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualApplianceSitesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualApplianceSites List. */ +public final class VirtualApplianceSitesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkVirtualApplianceSiteList.json + */ + /** + * Sample code: List all Network Virtual Appliance sites for a given Network Virtual Appliance. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllNetworkVirtualApplianceSitesForAGivenNetworkVirtualAppliance( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualApplianceSites().list("rg1", "nva", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualApplianceSkusGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualApplianceSkusGetSamples.java new file mode 100644 index 0000000000000..1706b06c9e58a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualApplianceSkusGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualApplianceSkus Get. */ +public final class VirtualApplianceSkusGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkVirtualApplianceSkuGet.json + */ + /** + * Sample code: NetworkVirtualApplianceSkuGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void networkVirtualApplianceSkuGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualApplianceSkus() + .getWithResponse("ciscoSdwan", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualApplianceSkusListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualApplianceSkusListSamples.java new file mode 100644 index 0000000000000..2c94d012e5235 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualApplianceSkusListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualApplianceSkus List. */ +public final class VirtualApplianceSkusListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/NetworkVirtualApplianceSkuList.json + */ + /** + * Sample code: NetworkVirtualApplianceSkuListResult. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void networkVirtualApplianceSkuListResult(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualApplianceSkus().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubBgpConnectionsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubBgpConnectionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..492e910c09948 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubBgpConnectionsCreateOrUpdateSamples.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.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.BgpConnectionInner; + +/** Samples for VirtualHubBgpConnections CreateOrUpdate. */ +public final class VirtualHubBgpConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualHubBgpConnectionPut.json + */ + /** + * Sample code: VirtualHubRouteTableV2Put. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualHubRouteTableV2Put(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualHubBgpConnections() + .createOrUpdate( + "rg1", + "hub1", + "conn1", + new BgpConnectionInner() + .withPeerAsn(20000L) + .withPeerIp("192.168.1.5") + .withHubVirtualNetworkConnection( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/hub1/hubVirtualNetworkConnections/hubVnetConn1")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubBgpConnectionsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubBgpConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..c32834c9a62c5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubBgpConnectionsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualHubBgpConnections Delete. */ +public final class VirtualHubBgpConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualHubBgpConnectionDelete.json + */ + /** + * Sample code: VirtualHubRouteTableV2Delete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualHubRouteTableV2Delete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualHubBgpConnections() + .delete("rg1", "hub1", "conn1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubBgpConnectionsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubBgpConnectionsGetSamples.java new file mode 100644 index 0000000000000..1763096226940 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubBgpConnectionsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualHubBgpConnections Get. */ +public final class VirtualHubBgpConnectionsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualHubBgpConnectionGet.json + */ + /** + * Sample code: VirtualHubVirtualHubRouteTableV2Get. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualHubVirtualHubRouteTableV2Get(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualHubBgpConnections() + .getWithResponse("rg1", "hub1", "conn1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubBgpConnectionsListAdvertisedRoutesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubBgpConnectionsListAdvertisedRoutesSamples.java new file mode 100644 index 0000000000000..54dbf4e1130aa --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubBgpConnectionsListAdvertisedRoutesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualHubBgpConnections ListAdvertisedRoutes. */ +public final class VirtualHubBgpConnectionsListAdvertisedRoutesSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualRouterPeerListAdvertisedRoute.json + */ + /** + * Sample code: VirtualRouterPeerListAdvertisedRoutes. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualRouterPeerListAdvertisedRoutes(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualHubBgpConnections() + .listAdvertisedRoutes("rg1", "virtualRouter1", "peer1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubBgpConnectionsListLearnedRoutesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubBgpConnectionsListLearnedRoutesSamples.java new file mode 100644 index 0000000000000..7d1e696543ca9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubBgpConnectionsListLearnedRoutesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualHubBgpConnections ListLearnedRoutes. */ +public final class VirtualHubBgpConnectionsListLearnedRoutesSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualRouterPeerListLearnedRoute.json + */ + /** + * Sample code: VirtualRouterPeerListLearnedRoutes. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualRouterPeerListLearnedRoutes(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualHubBgpConnections() + .listLearnedRoutes("rg1", "virtualRouter1", "peer1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubBgpConnectionsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubBgpConnectionsListSamples.java new file mode 100644 index 0000000000000..163790404bc8f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubBgpConnectionsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualHubBgpConnections List. */ +public final class VirtualHubBgpConnectionsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualHubBgpConnectionList.json + */ + /** + * Sample code: VirtualHubRouteTableV2List. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualHubRouteTableV2List(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualHubBgpConnections().list("rg1", "hub1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubIpConfigurationCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubIpConfigurationCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..3f85b0b403ba5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubIpConfigurationCreateOrUpdateSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.HubIpConfigurationInner; +import com.azure.resourcemanager.network.fluent.models.SubnetInner; + +/** Samples for VirtualHubIpConfiguration CreateOrUpdate. */ +public final class VirtualHubIpConfigurationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualHubIpConfigurationPut.json + */ + /** + * Sample code: VirtualHubIpConfigurationPut. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualHubIpConfigurationPut(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualHubIpConfigurations() + .createOrUpdate( + "rg1", + "hub1", + "ipconfig1", + new HubIpConfigurationInner() + .withSubnet( + new SubnetInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubIpConfigurationDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubIpConfigurationDeleteSamples.java new file mode 100644 index 0000000000000..9013b05caf661 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubIpConfigurationDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualHubIpConfiguration Delete. */ +public final class VirtualHubIpConfigurationDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualHubIpConfigurationDelete.json + */ + /** + * Sample code: VirtualHubIpConfigurationDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualHubIpConfigurationDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualHubIpConfigurations() + .delete("rg1", "hub1", "ipconfig1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubIpConfigurationGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubIpConfigurationGetSamples.java new file mode 100644 index 0000000000000..6def5145cb4e6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubIpConfigurationGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualHubIpConfiguration Get. */ +public final class VirtualHubIpConfigurationGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualHubIpConfigurationGet.json + */ + /** + * Sample code: VirtualHubVirtualHubRouteTableV2Get. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualHubVirtualHubRouteTableV2Get(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualHubIpConfigurations() + .getWithResponse("rg1", "hub1", "ipconfig1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubIpConfigurationListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubIpConfigurationListSamples.java new file mode 100644 index 0000000000000..2519100fb8680 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubIpConfigurationListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualHubIpConfiguration List. */ +public final class VirtualHubIpConfigurationListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualHubIpConfigurationList.json + */ + /** + * Sample code: VirtualHubRouteTableV2List. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualHubRouteTableV2List(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualHubIpConfigurations().list("rg1", "hub1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubRouteTableV2SCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubRouteTableV2SCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..a5dc0e2d9b869 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubRouteTableV2SCreateOrUpdateSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.VirtualHubRouteTableV2Inner; +import com.azure.resourcemanager.network.models.VirtualHubRouteV2; +import java.util.Arrays; + +/** Samples for VirtualHubRouteTableV2S CreateOrUpdate. */ +public final class VirtualHubRouteTableV2SCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualHubRouteTableV2Put.json + */ + /** + * Sample code: VirtualHubRouteTableV2Put. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualHubRouteTableV2Put(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualHubRouteTableV2S() + .createOrUpdate( + "rg1", + "virtualHub1", + "virtualHubRouteTable1a", + new VirtualHubRouteTableV2Inner() + .withRoutes( + Arrays + .asList( + new VirtualHubRouteV2() + .withDestinationType("CIDR") + .withDestinations(Arrays.asList("20.10.0.0/16", "20.20.0.0/16")) + .withNextHopType("IPAddress") + .withNextHops(Arrays.asList("10.0.0.68")), + new VirtualHubRouteV2() + .withDestinationType("CIDR") + .withDestinations(Arrays.asList("0.0.0.0/0")) + .withNextHopType("IPAddress") + .withNextHops(Arrays.asList("10.0.0.68")))) + .withAttachedConnections(Arrays.asList("All_Vnets")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubRouteTableV2SDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubRouteTableV2SDeleteSamples.java new file mode 100644 index 0000000000000..d2651f709981d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubRouteTableV2SDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualHubRouteTableV2S Delete. */ +public final class VirtualHubRouteTableV2SDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualHubRouteTableV2Delete.json + */ + /** + * Sample code: VirtualHubRouteTableV2Delete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualHubRouteTableV2Delete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualHubRouteTableV2S() + .delete("rg1", "virtualHub1", "virtualHubRouteTable1a", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubRouteTableV2SGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubRouteTableV2SGetSamples.java new file mode 100644 index 0000000000000..51e89372cad40 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubRouteTableV2SGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualHubRouteTableV2S Get. */ +public final class VirtualHubRouteTableV2SGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualHubRouteTableV2Get.json + */ + /** + * Sample code: VirtualHubVirtualHubRouteTableV2Get. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualHubVirtualHubRouteTableV2Get(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualHubRouteTableV2S() + .getWithResponse("rg1", "virtualHub1", "virtualHubRouteTable1a", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubRouteTableV2SListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubRouteTableV2SListSamples.java new file mode 100644 index 0000000000000..9bbb3963ff899 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubRouteTableV2SListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualHubRouteTableV2S List. */ +public final class VirtualHubRouteTableV2SListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualHubRouteTableV2List.json + */ + /** + * Sample code: VirtualHubRouteTableV2List. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualHubRouteTableV2List(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualHubRouteTableV2S() + .list("rg1", "virtualHub1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..63045492f60dc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubsCreateOrUpdateSamples.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.VirtualHubInner; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualHubs CreateOrUpdate. */ +public final class VirtualHubsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualHubPut.json + */ + /** + * Sample code: VirtualHubPut. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualHubPut(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualHubs() + .createOrUpdate( + "rg1", + "virtualHub2", + new VirtualHubInner() + .withLocation("West US") + .withTags(mapOf("key1", "value1")) + .withVirtualWan( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualWans/virtualWan1")) + .withAddressPrefix("10.168.0.0/24") + .withSku("Basic"), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubsDeleteSamples.java new file mode 100644 index 0000000000000..a1676c32b6771 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubsDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualHubs Delete. */ +public final class VirtualHubsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualHubDelete.json + */ + /** + * Sample code: VirtualHubDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualHubDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualHubs().delete("rg1", "virtualHub1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..65816b357212b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubsGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualHubs GetByResourceGroup. */ +public final class VirtualHubsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualHubGet.json + */ + /** + * Sample code: VirtualHubGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualHubGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualHubs() + .getByResourceGroupWithResponse("rg1", "virtualHub1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubsGetEffectiveVirtualHubRoutesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubsGetEffectiveVirtualHubRoutesSamples.java new file mode 100644 index 0000000000000..610e7a27dcf25 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubsGetEffectiveVirtualHubRoutesSamples.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.EffectiveRoutesParameters; + +/** Samples for VirtualHubs GetEffectiveVirtualHubRoutes. */ +public final class VirtualHubsGetEffectiveVirtualHubRoutesSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/EffectiveRoutesListForRouteTable.json + */ + /** + * Sample code: Effective Routes for a Route Table resource. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void effectiveRoutesForARouteTableResource(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualHubs() + .getEffectiveVirtualHubRoutes( + "rg1", + "virtualHub1", + new EffectiveRoutesParameters() + .withResourceId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/hubRouteTables/hubRouteTable1") + .withVirtualWanResourceType("RouteTable"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/EffectiveRoutesListForConnection.json + */ + /** + * Sample code: Effective Routes for a Connection resource. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void effectiveRoutesForAConnectionResource(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualHubs() + .getEffectiveVirtualHubRoutes( + "rg1", + "virtualHub1", + new EffectiveRoutesParameters() + .withResourceId( + "/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteGateways/expressRouteGatewayName/expressRouteConnections/connectionName") + .withVirtualWanResourceType("ExpressRouteConnection"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/EffectiveRoutesListForVirtualHub.json + */ + /** + * Sample code: Effective Routes for the Virtual Hub. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void effectiveRoutesForTheVirtualHub(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualHubs() + .getEffectiveVirtualHubRoutes("rg1", "virtualHub1", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..1f9e08fbb4441 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubsListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualHubs ListByResourceGroup. */ +public final class VirtualHubsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualHubListByResourceGroup.json + */ + /** + * Sample code: VirtualHubListByResourceGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualHubListByResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualHubs().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubsListSamples.java new file mode 100644 index 0000000000000..9c279ecd18257 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualHubs List. */ +public final class VirtualHubsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualHubList.json + */ + /** + * Sample code: VirtualHubList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualHubList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualHubs().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubsUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubsUpdateTagsSamples.java new file mode 100644 index 0000000000000..aaa6413d02525 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualHubsUpdateTagsSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualHubs UpdateTags. */ +public final class VirtualHubsUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualHubUpdateTags.json + */ + /** + * Sample code: VirtualHubUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualHubUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualHubs() + .updateTagsWithResponse( + "rg1", + "virtualHub2", + new TagsObject().withTags(mapOf("key1", "value1", "key2", "value2")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..f8d049143962e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsCreateOrUpdateSamples.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.LocalNetworkGatewayInner; +import com.azure.resourcemanager.network.fluent.models.VirtualNetworkGatewayConnectionInner; +import com.azure.resourcemanager.network.fluent.models.VirtualNetworkGatewayInner; +import com.azure.resourcemanager.network.fluent.models.VirtualNetworkGatewayIpConfigurationInner; +import com.azure.resourcemanager.network.models.AddressSpace; +import com.azure.resourcemanager.network.models.BgpSettings; +import com.azure.resourcemanager.network.models.IpAllocationMethod; +import com.azure.resourcemanager.network.models.VirtualNetworkGatewayConnectionMode; +import com.azure.resourcemanager.network.models.VirtualNetworkGatewayConnectionProtocol; +import com.azure.resourcemanager.network.models.VirtualNetworkGatewayConnectionType; +import com.azure.resourcemanager.network.models.VirtualNetworkGatewaySku; +import com.azure.resourcemanager.network.models.VirtualNetworkGatewaySkuName; +import com.azure.resourcemanager.network.models.VirtualNetworkGatewaySkuTier; +import com.azure.resourcemanager.network.models.VirtualNetworkGatewayType; +import com.azure.resourcemanager.network.models.VpnType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualNetworkGatewayConnections CreateOrUpdate. */ +public final class VirtualNetworkGatewayConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayConnectionCreate.json + */ + /** + * Sample code: CreateVirtualNetworkGatewayConnection_S2S. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createVirtualNetworkGatewayConnectionS2S(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGatewayConnections() + .createOrUpdate( + "rg1", + "connS2S", + new VirtualNetworkGatewayConnectionInner() + .withLocation("centralus") + .withVirtualNetworkGateway1( + new VirtualNetworkGatewayInner() + .withLocation("centralus") + .withTags(mapOf()) + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw") + .withIpConfigurations( + Arrays + .asList( + new VirtualNetworkGatewayIpConfigurationInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/ipConfigurations/gwipconfig1") + .withName("gwipconfig1") + .withPrivateIpAllocationMethod(IpAllocationMethod.DYNAMIC) + .withSubnet( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/GatewaySubnet")) + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/gwpip")))) + .withGatewayType(VirtualNetworkGatewayType.VPN) + .withVpnType(VpnType.ROUTE_BASED) + .withEnableBgp(false) + .withActive(false) + .withSku( + new VirtualNetworkGatewaySku() + .withName(VirtualNetworkGatewaySkuName.VPN_GW1) + .withTier(VirtualNetworkGatewaySkuTier.VPN_GW1)) + .withBgpSettings( + new BgpSettings().withAsn(65514L).withBgpPeeringAddress("10.0.1.30").withPeerWeight(0))) + .withLocalNetworkGateway2( + new LocalNetworkGatewayInner() + .withLocation("centralus") + .withTags(mapOf()) + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/localNetworkGateways/localgw") + .withLocalNetworkAddressSpace( + new AddressSpace().withAddressPrefixes(Arrays.asList("10.1.0.0/16"))) + .withGatewayIpAddress("x.x.x.x")) + .withIngressNatRules( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule1"))) + .withEgressNatRules( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule2"))) + .withConnectionType(VirtualNetworkGatewayConnectionType.IPSEC) + .withConnectionProtocol(VirtualNetworkGatewayConnectionProtocol.IKEV2) + .withRoutingWeight(0) + .withDpdTimeoutSeconds(30) + .withConnectionMode(VirtualNetworkGatewayConnectionMode.DEFAULT) + .withSharedKey("Abc123") + .withEnableBgp(false) + .withUsePolicyBasedTrafficSelectors(false) + .withIpsecPolicies(Arrays.asList()) + .withTrafficSelectorPolicies(Arrays.asList()), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..abdb12b81071e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGatewayConnections Delete. */ +public final class VirtualNetworkGatewayConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayConnectionDelete.json + */ + /** + * Sample code: DeleteVirtualNetworkGatewayConnection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteVirtualNetworkGatewayConnection(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGatewayConnections() + .delete("rg1", "conn1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..31e04eb6505cb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGatewayConnections GetByResourceGroup. */ +public final class VirtualNetworkGatewayConnectionsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayConnectionGet.json + */ + /** + * Sample code: GetVirtualNetworkGatewayConnection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualNetworkGatewayConnection(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGatewayConnections() + .getByResourceGroupWithResponse("rg1", "connS2S", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsGetIkeSasSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsGetIkeSasSamples.java new file mode 100644 index 0000000000000..69328b610a436 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsGetIkeSasSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGatewayConnections GetIkeSas. */ +public final class VirtualNetworkGatewayConnectionsGetIkeSasSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayConnectionGetIkeSas.json + */ + /** + * Sample code: GetVirtualNetworkGatewayConnectionIkeSa. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualNetworkGatewayConnectionIkeSa(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGatewayConnections() + .getIkeSas("rg1", "vpngwcn1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsGetSharedKeySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsGetSharedKeySamples.java new file mode 100644 index 0000000000000..4e6f567c0f460 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsGetSharedKeySamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGatewayConnections GetSharedKey. */ +public final class VirtualNetworkGatewayConnectionsGetSharedKeySamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayConnectionGetSharedKey.json + */ + /** + * Sample code: GetVirtualNetworkGatewayConnectionSharedKey. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualNetworkGatewayConnectionSharedKey( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGatewayConnections() + .getSharedKeyWithResponse("rg1", "connS2S", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..409b114fdb3e6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsListByResourceGroupSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGatewayConnections ListByResourceGroup. */ +public final class VirtualNetworkGatewayConnectionsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayConnectionsList.json + */ + /** + * Sample code: ListVirtualNetworkGatewayConnectionsinResourceGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listVirtualNetworkGatewayConnectionsinResourceGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGatewayConnections() + .listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsResetConnectionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsResetConnectionSamples.java new file mode 100644 index 0000000000000..5e3603ac7fd13 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsResetConnectionSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGatewayConnections ResetConnection. */ +public final class VirtualNetworkGatewayConnectionsResetConnectionSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayConnectionReset.json + */ + /** + * Sample code: ResetVirtualNetworkGatewayConnection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void resetVirtualNetworkGatewayConnection(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGatewayConnections() + .resetConnection("rg1", "conn1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsResetSharedKeySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsResetSharedKeySamples.java new file mode 100644 index 0000000000000..d619e01b50d14 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsResetSharedKeySamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.ConnectionResetSharedKeyInner; + +/** Samples for VirtualNetworkGatewayConnections ResetSharedKey. */ +public final class VirtualNetworkGatewayConnectionsResetSharedKeySamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayConnectionResetSharedKey.json + */ + /** + * Sample code: ResetVirtualNetworkGatewayConnectionSharedKey. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void resetVirtualNetworkGatewayConnectionSharedKey( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGatewayConnections() + .resetSharedKey("rg1", "conn1", new ConnectionResetSharedKeyInner().withKeyLength(128), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsSetSharedKeySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsSetSharedKeySamples.java new file mode 100644 index 0000000000000..6af6ed07929cc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsSetSharedKeySamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.ConnectionSharedKeyInner; + +/** Samples for VirtualNetworkGatewayConnections SetSharedKey. */ +public final class VirtualNetworkGatewayConnectionsSetSharedKeySamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayConnectionSetSharedKey.json + */ + /** + * Sample code: SetVirtualNetworkGatewayConnectionSharedKey. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void setVirtualNetworkGatewayConnectionSharedKey( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGatewayConnections() + .setSharedKey("rg1", "connS2S", new ConnectionSharedKeyInner().withValue("AzureAbc123"), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsStartPacketCaptureSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsStartPacketCaptureSamples.java new file mode 100644 index 0000000000000..da8d85d0aaf9d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsStartPacketCaptureSamples.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.VpnPacketCaptureStartParameters; + +/** Samples for VirtualNetworkGatewayConnections StartPacketCapture. */ +public final class VirtualNetworkGatewayConnectionsStartPacketCaptureSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayConnectionStartPacketCapture.json + */ + /** + * Sample code: Start packet capture on virtual network gateway connection without filter. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void startPacketCaptureOnVirtualNetworkGatewayConnectionWithoutFilter( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGatewayConnections() + .startPacketCapture("rg1", "vpngwcn1", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayConnectionStartPacketCaptureFilterData.json + */ + /** + * Sample code: Start packet capture on virtual network gateway connection with filter. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void startPacketCaptureOnVirtualNetworkGatewayConnectionWithFilter( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGatewayConnections() + .startPacketCapture( + "rg1", + "vpngwcn1", + new VpnPacketCaptureStartParameters() + .withFilterData( + "{'TracingFlags': 11,'MaxPacketBufferSize': 120,'MaxFileSize': 200,'Filters':" + + " [{'SourceSubnets': ['20.1.1.0/24'],'DestinationSubnets': ['10.1.1.0/24'],'SourcePort':" + + " [500],'DestinationPort': [4500],'Protocol': 6,'TcpFlags':" + + " 16,'CaptureSingleDirectionTrafficOnly': true}]}"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsStopPacketCaptureSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsStopPacketCaptureSamples.java new file mode 100644 index 0000000000000..9fc419c2f62d9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsStopPacketCaptureSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.VpnPacketCaptureStopParameters; + +/** Samples for VirtualNetworkGatewayConnections StopPacketCapture. */ +public final class VirtualNetworkGatewayConnectionsStopPacketCaptureSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayConnectionStopPacketCapture.json + */ + /** + * Sample code: Stop packet capture on virtual network gateway connection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void stopPacketCaptureOnVirtualNetworkGatewayConnection( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGatewayConnections() + .stopPacketCapture( + "rg1", + "vpngwcn1", + new VpnPacketCaptureStopParameters() + .withSasUrl( + "https://teststorage.blob.core.windows.net/?sv=2018-03-28&ss=bfqt&srt=sco&sp=rwdlacup&se=2019-09-13T07:44:05Z&st=2019-09-06T23:44:05Z&spr=https&sig=V1h9D1riltvZMI69d6ihENnFo%2FrCvTqGgjO2lf%2FVBhE%3D"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsUpdateTagsSamples.java new file mode 100644 index 0000000000000..e41f7c1aa5660 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayConnectionsUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualNetworkGatewayConnections UpdateTags. */ +public final class VirtualNetworkGatewayConnectionsUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayConnectionUpdateTags.json + */ + /** + * Sample code: UpdateVirtualNetworkGatewayConnectionTags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateVirtualNetworkGatewayConnectionTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGatewayConnections() + .updateTags( + "rg1", "test", new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayNatRulesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayNatRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..2234478663574 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayNatRulesCreateOrUpdateSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.VirtualNetworkGatewayNatRuleInner; +import com.azure.resourcemanager.network.models.VpnNatRuleMapping; +import com.azure.resourcemanager.network.models.VpnNatRuleMode; +import com.azure.resourcemanager.network.models.VpnNatRuleType; +import java.util.Arrays; + +/** Samples for VirtualNetworkGatewayNatRules CreateOrUpdate. */ +public final class VirtualNetworkGatewayNatRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayNatRulePut.json + */ + /** + * Sample code: VirtualNetworkGatewayNatRulePut. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualNetworkGatewayNatRulePut(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGatewayNatRules() + .createOrUpdate( + "rg1", + "gateway1", + "natRule1", + new VirtualNetworkGatewayNatRuleInner() + .withTypePropertiesType(VpnNatRuleType.STATIC) + .withMode(VpnNatRuleMode.EGRESS_SNAT) + .withInternalMappings( + Arrays.asList(new VpnNatRuleMapping().withAddressSpace("10.4.0.0/24").withPortRange("200-300"))) + .withExternalMappings( + Arrays + .asList( + new VpnNatRuleMapping().withAddressSpace("192.168.21.0/24").withPortRange("300-400"))) + .withIpConfigurationId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/gateway1/ipConfigurations/default"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayNatRulesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayNatRulesDeleteSamples.java new file mode 100644 index 0000000000000..aca2cb270d038 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayNatRulesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGatewayNatRules Delete. */ +public final class VirtualNetworkGatewayNatRulesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayNatRuleDelete.json + */ + /** + * Sample code: VirtualNetworkGatewayNatRuleDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualNetworkGatewayNatRuleDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGatewayNatRules() + .delete("rg1", "gateway1", "natRule1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayNatRulesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayNatRulesGetSamples.java new file mode 100644 index 0000000000000..f63bd88c8ac41 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayNatRulesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGatewayNatRules Get. */ +public final class VirtualNetworkGatewayNatRulesGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayNatRuleGet.json + */ + /** + * Sample code: VirtualNetworkGatewayNatRuleGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualNetworkGatewayNatRuleGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGatewayNatRules() + .getWithResponse("rg1", "gateway1", "natRule1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayNatRulesListByVirtualNetworkGatewaySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayNatRulesListByVirtualNetworkGatewaySamples.java new file mode 100644 index 0000000000000..002a63973726b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewayNatRulesListByVirtualNetworkGatewaySamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGatewayNatRules ListByVirtualNetworkGateway. */ +public final class VirtualNetworkGatewayNatRulesListByVirtualNetworkGatewaySamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayNatRuleList.json + */ + /** + * Sample code: VirtualNetworkGatewayNatRuleList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualNetworkGatewayNatRuleList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGatewayNatRules() + .listByVirtualNetworkGateway("rg1", "gateway1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..a5bfddcba0273 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysCreateOrUpdateSamples.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.VirtualNetworkGatewayInner; +import com.azure.resourcemanager.network.fluent.models.VirtualNetworkGatewayIpConfigurationInner; +import com.azure.resourcemanager.network.fluent.models.VirtualNetworkGatewayNatRuleInner; +import com.azure.resourcemanager.network.models.AddressSpace; +import com.azure.resourcemanager.network.models.BgpSettings; +import com.azure.resourcemanager.network.models.IpAllocationMethod; +import com.azure.resourcemanager.network.models.RadiusServer; +import com.azure.resourcemanager.network.models.VirtualNetworkGatewaySku; +import com.azure.resourcemanager.network.models.VirtualNetworkGatewaySkuName; +import com.azure.resourcemanager.network.models.VirtualNetworkGatewaySkuTier; +import com.azure.resourcemanager.network.models.VirtualNetworkGatewayType; +import com.azure.resourcemanager.network.models.VpnClientConfiguration; +import com.azure.resourcemanager.network.models.VpnClientProtocol; +import com.azure.resourcemanager.network.models.VpnNatRuleMapping; +import com.azure.resourcemanager.network.models.VpnNatRuleMode; +import com.azure.resourcemanager.network.models.VpnNatRuleType; +import com.azure.resourcemanager.network.models.VpnType; +import java.util.Arrays; + +/** Samples for VirtualNetworkGateways CreateOrUpdate. */ +public final class VirtualNetworkGatewaysCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayUpdate.json + */ + /** + * Sample code: UpdateVirtualNetworkGateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateVirtualNetworkGateway(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGateways() + .createOrUpdate( + "rg1", + "vpngw", + new VirtualNetworkGatewayInner() + .withLocation("centralus") + .withIpConfigurations( + Arrays + .asList( + new VirtualNetworkGatewayIpConfigurationInner() + .withName("gwipconfig1") + .withPrivateIpAllocationMethod(IpAllocationMethod.DYNAMIC) + .withSubnet( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/GatewaySubnet")) + .withPublicIpAddress( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/gwpip")))) + .withGatewayType(VirtualNetworkGatewayType.VPN) + .withVpnType(VpnType.ROUTE_BASED) + .withEnableBgp(false) + .withActive(false) + .withDisableIpSecReplayProtection(false) + .withSku( + new VirtualNetworkGatewaySku() + .withName(VirtualNetworkGatewaySkuName.VPN_GW1) + .withTier(VirtualNetworkGatewaySkuTier.VPN_GW1)) + .withVpnClientConfiguration( + new VpnClientConfiguration() + .withVpnClientRootCertificates(Arrays.asList()) + .withVpnClientRevokedCertificates(Arrays.asList()) + .withVpnClientProtocols(Arrays.asList(VpnClientProtocol.OPEN_VPN)) + .withRadiusServers( + Arrays + .asList( + new RadiusServer() + .withRadiusServerAddress("10.2.0.0") + .withRadiusServerScore(20L) + .withRadiusServerSecret("radiusServerSecret")))) + .withBgpSettings( + new BgpSettings().withAsn(65515L).withBgpPeeringAddress("10.0.1.30").withPeerWeight(0)) + .withCustomRoutes(new AddressSpace().withAddressPrefixes(Arrays.asList("101.168.0.6/32"))) + .withEnableDnsForwarding(true) + .withNatRules( + Arrays + .asList( + new VirtualNetworkGatewayNatRuleInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule1") + .withName("natRule1") + .withTypePropertiesType(VpnNatRuleType.STATIC) + .withMode(VpnNatRuleMode.EGRESS_SNAT) + .withInternalMappings( + Arrays.asList(new VpnNatRuleMapping().withAddressSpace("10.10.0.0/24"))) + .withExternalMappings( + Arrays.asList(new VpnNatRuleMapping().withAddressSpace("50.0.0.0/24"))) + .withIpConfigurationId(""), + new VirtualNetworkGatewayNatRuleInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vpngw/natRules/natRule2") + .withName("natRule2") + .withTypePropertiesType(VpnNatRuleType.STATIC) + .withMode(VpnNatRuleMode.INGRESS_SNAT) + .withInternalMappings( + Arrays.asList(new VpnNatRuleMapping().withAddressSpace("20.10.0.0/24"))) + .withExternalMappings( + Arrays.asList(new VpnNatRuleMapping().withAddressSpace("30.0.0.0/24"))) + .withIpConfigurationId(""))) + .withEnableBgpRouteTranslationForNat(false), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysDeleteSamples.java new file mode 100644 index 0000000000000..d4dacf492a531 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGateways Delete. */ +public final class VirtualNetworkGatewaysDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayDelete.json + */ + /** + * Sample code: DeleteVirtualNetworkGateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteVirtualNetworkGateway(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualNetworkGateways().delete("rg1", "vpngw", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsSamples.java new file mode 100644 index 0000000000000..e8c344baeb3ab --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.P2SVpnConnectionRequest; +import java.util.Arrays; + +/** Samples for VirtualNetworkGateways DisconnectVirtualNetworkGatewayVpnConnections. */ +public final class VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewaysDisconnectP2sVpnConnections.json + */ + /** + * Sample code: Disconnect VpnConnections from Virtual Network Gateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void disconnectVpnConnectionsFromVirtualNetworkGateway( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGateways() + .disconnectVirtualNetworkGatewayVpnConnections( + "vpn-gateway-test", + "vpngateway", + new P2SVpnConnectionRequest().withVpnConnectionIds(Arrays.asList("vpnconnId1", "vpnconnId2")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGenerateVpnProfileSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGenerateVpnProfileSamples.java new file mode 100644 index 0000000000000..b6fbde9c69f95 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGenerateVpnProfileSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.VpnClientParameters; + +/** Samples for VirtualNetworkGateways GenerateVpnProfile. */ +public final class VirtualNetworkGatewaysGenerateVpnProfileSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayGenerateVpnProfile.json + */ + /** + * Sample code: GenerateVirtualNetworkGatewayVPNProfile. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void generateVirtualNetworkGatewayVPNProfile(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGateways() + .generateVpnProfile("rg1", "vpngw", new VpnClientParameters(), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGeneratevpnclientpackageSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGeneratevpnclientpackageSamples.java new file mode 100644 index 0000000000000..ebc49844d1825 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGeneratevpnclientpackageSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.VpnClientParameters; + +/** Samples for VirtualNetworkGateways Generatevpnclientpackage. */ +public final class VirtualNetworkGatewaysGeneratevpnclientpackageSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayGenerateVpnClientPackage.json + */ + /** + * Sample code: GenerateVPNClientPackage. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void generateVPNClientPackage(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGateways() + .generatevpnclientpackage("rg1", "vpngw", new VpnClientParameters(), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGetAdvertisedRoutesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGetAdvertisedRoutesSamples.java new file mode 100644 index 0000000000000..e12f7113e4db5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGetAdvertisedRoutesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGateways GetAdvertisedRoutes. */ +public final class VirtualNetworkGatewaysGetAdvertisedRoutesSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayGetAdvertisedRoutes.json + */ + /** + * Sample code: GetVirtualNetworkGatewayAdvertisedRoutes. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualNetworkGatewayAdvertisedRoutes(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGateways() + .getAdvertisedRoutes("rg1", "vpngw", "test", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGetBgpPeerStatusSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGetBgpPeerStatusSamples.java new file mode 100644 index 0000000000000..b35a00c33bbf1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGetBgpPeerStatusSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGateways GetBgpPeerStatus. */ +public final class VirtualNetworkGatewaysGetBgpPeerStatusSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayGetBGPPeerStatus.json + */ + /** + * Sample code: GetVirtualNetworkGatewayBGPPeerStatus. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualNetworkGatewayBGPPeerStatus(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGateways() + .getBgpPeerStatus("rg1", "vpngw", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..4c2504c1b8ada --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGateways GetByResourceGroup. */ +public final class VirtualNetworkGatewaysGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayGet.json + */ + /** + * Sample code: GetVirtualNetworkGateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualNetworkGateway(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGateways() + .getByResourceGroupWithResponse("rg1", "vpngw", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGetLearnedRoutesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGetLearnedRoutesSamples.java new file mode 100644 index 0000000000000..aae9742373b60 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGetLearnedRoutesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGateways GetLearnedRoutes. */ +public final class VirtualNetworkGatewaysGetLearnedRoutesSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayLearnedRoutes.json + */ + /** + * Sample code: GetVirtualNetworkGatewayLearnedRoutes. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualNetworkGatewayLearnedRoutes(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGateways() + .getLearnedRoutes("rg1", "vpngw", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGetVpnProfilePackageUrlSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGetVpnProfilePackageUrlSamples.java new file mode 100644 index 0000000000000..885592052adf5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGetVpnProfilePackageUrlSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGateways GetVpnProfilePackageUrl. */ +public final class VirtualNetworkGatewaysGetVpnProfilePackageUrlSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayGetVpnProfilePackageUrl.json + */ + /** + * Sample code: GetVirtualNetworkGatewayVPNProfilePackageURL. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualNetworkGatewayVPNProfilePackageURL( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGateways() + .getVpnProfilePackageUrl("rg1", "vpngw", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGetVpnclientConnectionHealthSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGetVpnclientConnectionHealthSamples.java new file mode 100644 index 0000000000000..812e06ab3255e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGetVpnclientConnectionHealthSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGateways GetVpnclientConnectionHealth. */ +public final class VirtualNetworkGatewaysGetVpnclientConnectionHealthSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayGetVpnclientConnectionHealth.json + */ + /** + * Sample code: GetVirtualNetworkGatewayVpnclientConnectionHealth. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualNetworkGatewayVpnclientConnectionHealth( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGateways() + .getVpnclientConnectionHealth("p2s-vnet-test", "vpnp2sgw", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGetVpnclientIpsecParametersSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGetVpnclientIpsecParametersSamples.java new file mode 100644 index 0000000000000..5b27c8b7d07f8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysGetVpnclientIpsecParametersSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGateways GetVpnclientIpsecParameters. */ +public final class VirtualNetworkGatewaysGetVpnclientIpsecParametersSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayGetVpnClientIpsecParameters.json + */ + /** + * Sample code: Get VirtualNetworkGateway VpnClientIpsecParameters. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualNetworkGatewayVpnClientIpsecParameters( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGateways() + .getVpnclientIpsecParameters("rg1", "vpngw", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysListByResourceGroupSamples.java new file mode 100644 index 0000000000000..3e6ef83eabd6f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGateways ListByResourceGroup. */ +public final class VirtualNetworkGatewaysListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayList.json + */ + /** + * Sample code: ListVirtualNetworkGatewaysinResourceGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listVirtualNetworkGatewaysinResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualNetworkGateways().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysListConnectionsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysListConnectionsSamples.java new file mode 100644 index 0000000000000..6de9845f05037 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysListConnectionsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGateways ListConnections. */ +public final class VirtualNetworkGatewaysListConnectionsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewaysListConnections.json + */ + /** + * Sample code: VirtualNetworkGatewaysListConnections. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualNetworkGatewaysListConnections(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGateways() + .listConnections("testrg", "test-vpn-gateway-1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysResetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysResetSamples.java new file mode 100644 index 0000000000000..893f39522b713 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysResetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGateways Reset. */ +public final class VirtualNetworkGatewaysResetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayReset.json + */ + /** + * Sample code: ResetVirtualNetworkGateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void resetVirtualNetworkGateway(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGateways() + .reset("rg1", "vpngw", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysResetVpnClientSharedKeySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysResetVpnClientSharedKeySamples.java new file mode 100644 index 0000000000000..f31d336ddc960 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysResetVpnClientSharedKeySamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGateways ResetVpnClientSharedKey. */ +public final class VirtualNetworkGatewaysResetVpnClientSharedKeySamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayResetVpnClientSharedKey.json + */ + /** + * Sample code: ResetVpnClientSharedKey. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void resetVpnClientSharedKey(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGateways() + .resetVpnClientSharedKey("rg1", "vpngw", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysSetVpnclientIpsecParametersSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysSetVpnclientIpsecParametersSamples.java new file mode 100644 index 0000000000000..8e683e41219ca --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysSetVpnclientIpsecParametersSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.VpnClientIPsecParametersInner; +import com.azure.resourcemanager.network.models.DhGroup; +import com.azure.resourcemanager.network.models.IkeEncryption; +import com.azure.resourcemanager.network.models.IkeIntegrity; +import com.azure.resourcemanager.network.models.IpsecEncryption; +import com.azure.resourcemanager.network.models.IpsecIntegrity; +import com.azure.resourcemanager.network.models.PfsGroup; + +/** Samples for VirtualNetworkGateways SetVpnclientIpsecParameters. */ +public final class VirtualNetworkGatewaysSetVpnclientIpsecParametersSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewaySetVpnClientIpsecParameters.json + */ + /** + * Sample code: Set VirtualNetworkGateway VpnClientIpsecParameters. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void setVirtualNetworkGatewayVpnClientIpsecParameters( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGateways() + .setVpnclientIpsecParameters( + "rg1", + "vpngw", + new VpnClientIPsecParametersInner() + .withSaLifeTimeSeconds(86473) + .withSaDataSizeKilobytes(429497) + .withIpsecEncryption(IpsecEncryption.AES256) + .withIpsecIntegrity(IpsecIntegrity.SHA256) + .withIkeEncryption(IkeEncryption.AES256) + .withIkeIntegrity(IkeIntegrity.SHA384) + .withDhGroup(DhGroup.DHGROUP2) + .withPfsGroup(PfsGroup.PFS2), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysStartPacketCaptureSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysStartPacketCaptureSamples.java new file mode 100644 index 0000000000000..29ce87ef47605 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysStartPacketCaptureSamples.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.VpnPacketCaptureStartParameters; + +/** Samples for VirtualNetworkGateways StartPacketCapture. */ +public final class VirtualNetworkGatewaysStartPacketCaptureSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayStartPacketCaptureFilterData.json + */ + /** + * Sample code: Start packet capture on virtual network gateway with filter. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void startPacketCaptureOnVirtualNetworkGatewayWithFilter( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGateways() + .startPacketCapture( + "rg1", + "vpngw", + new VpnPacketCaptureStartParameters() + .withFilterData( + "{'TracingFlags': 11,'MaxPacketBufferSize': 120,'MaxFileSize': 200,'Filters':" + + " [{'SourceSubnets': ['20.1.1.0/24'],'DestinationSubnets': ['10.1.1.0/24'],'SourcePort':" + + " [500],'DestinationPort': [4500],'Protocol': 6,'TcpFlags':" + + " 16,'CaptureSingleDirectionTrafficOnly': true}]}"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayStartPacketCapture.json + */ + /** + * Sample code: Start packet capture on virtual network gateway without filter. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void startPacketCaptureOnVirtualNetworkGatewayWithoutFilter( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGateways() + .startPacketCapture("rg1", "vpngw", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysStopPacketCaptureSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysStopPacketCaptureSamples.java new file mode 100644 index 0000000000000..ccae9452cc91d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysStopPacketCaptureSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.VpnPacketCaptureStopParameters; + +/** Samples for VirtualNetworkGateways StopPacketCapture. */ +public final class VirtualNetworkGatewaysStopPacketCaptureSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayStopPacketCapture.json + */ + /** + * Sample code: Stop packet capture on virtual network gateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void stopPacketCaptureOnVirtualNetworkGateway(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGateways() + .stopPacketCapture( + "rg1", + "vpngw", + new VpnPacketCaptureStopParameters() + .withSasUrl( + "https://teststorage.blob.core.windows.net/?sv=2018-03-28&ss=bfqt&srt=sco&sp=rwdlacup&se=2019-09-13T07:44:05Z&st=2019-09-06T23:44:05Z&spr=https&sig=V1h9D1riltvZMI69d6ihENnFo%2FrCvTqGgjO2lf%2FVBhE%3D"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysSupportedVpnDevicesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysSupportedVpnDevicesSamples.java new file mode 100644 index 0000000000000..fc505c63f3fb8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysSupportedVpnDevicesSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkGateways SupportedVpnDevices. */ +public final class VirtualNetworkGatewaysSupportedVpnDevicesSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewaySupportedVpnDevice.json + */ + /** + * Sample code: ListVirtualNetworkGatewaySupportedVPNDevices. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listVirtualNetworkGatewaySupportedVPNDevices( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGateways() + .supportedVpnDevicesWithResponse("rg1", "vpngw", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysUpdateTagsSamples.java new file mode 100644 index 0000000000000..b9fb3fccfd245 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualNetworkGateways UpdateTags. */ +public final class VirtualNetworkGatewaysUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayUpdateTags.json + */ + /** + * Sample code: UpdateVirtualNetworkGatewayTags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateVirtualNetworkGatewayTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGateways() + .updateTags( + "rg1", "vpngw", new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysVpnDeviceConfigurationScriptSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysVpnDeviceConfigurationScriptSamples.java new file mode 100644 index 0000000000000..69c55a7545f82 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkGatewaysVpnDeviceConfigurationScriptSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.VpnDeviceScriptParameters; + +/** Samples for VirtualNetworkGateways VpnDeviceConfigurationScript. */ +public final class VirtualNetworkGatewaysVpnDeviceConfigurationScriptSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGatewayVpnDeviceConfigurationScript.json + */ + /** + * Sample code: GetVPNDeviceConfigurationScript. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVPNDeviceConfigurationScript(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkGateways() + .vpnDeviceConfigurationScriptWithResponse( + "rg1", + "vpngw", + new VpnDeviceScriptParameters() + .withVendor("Cisco") + .withDeviceFamily("ISR") + .withFirmwareVersion("IOS 15.1 (Preview)"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkPeeringsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkPeeringsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..26ba2ea108bc4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkPeeringsCreateOrUpdateSamples.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.VirtualNetworkPeeringInner; +import com.azure.resourcemanager.network.models.SyncRemoteAddressSpace; + +/** Samples for VirtualNetworkPeerings CreateOrUpdate. */ +public final class VirtualNetworkPeeringsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkPeeringSync.json + */ + /** + * Sample code: Sync Peering. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void syncPeering(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkPeerings() + .createOrUpdate( + "peerTest", + "vnet1", + "peer", + new VirtualNetworkPeeringInner() + .withAllowVirtualNetworkAccess(true) + .withAllowForwardedTraffic(true) + .withAllowGatewayTransit(false) + .withUseRemoteGateways(false) + .withRemoteVirtualNetwork( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2")), + SyncRemoteAddressSpace.TRUE, + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkPeeringCreate.json + */ + /** + * Sample code: Create peering. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createPeering(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkPeerings() + .createOrUpdate( + "peerTest", + "vnet1", + "peer", + new VirtualNetworkPeeringInner() + .withAllowVirtualNetworkAccess(true) + .withAllowForwardedTraffic(true) + .withAllowGatewayTransit(false) + .withUseRemoteGateways(false) + .withRemoteVirtualNetwork( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2")), + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkPeeringCreateWithRemoteVirtualNetworkEncryption.json + */ + /** + * Sample code: Create peering with remote virtual network encryption. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createPeeringWithRemoteVirtualNetworkEncryption( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkPeerings() + .createOrUpdate( + "peerTest", + "vnet1", + "peer", + new VirtualNetworkPeeringInner() + .withAllowVirtualNetworkAccess(true) + .withAllowForwardedTraffic(true) + .withAllowGatewayTransit(false) + .withUseRemoteGateways(false) + .withRemoteVirtualNetwork( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/peerTest/providers/Microsoft.Network/virtualNetworks/vnet2")), + null, + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkPeeringsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkPeeringsDeleteSamples.java new file mode 100644 index 0000000000000..23d541baf9a9f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkPeeringsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkPeerings Delete. */ +public final class VirtualNetworkPeeringsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkPeeringDelete.json + */ + /** + * Sample code: Delete peering. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deletePeering(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkPeerings() + .delete("peerTest", "vnet1", "peer", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkPeeringsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkPeeringsGetSamples.java new file mode 100644 index 0000000000000..ee0c2c8bb6cb8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkPeeringsGetSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkPeerings Get. */ +public final class VirtualNetworkPeeringsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkPeeringGet.json + */ + /** + * Sample code: Get peering. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getPeering(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkPeerings() + .getWithResponse("peerTest", "vnet1", "peer", Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkPeeringGetWithRemoteVirtualNetworkEncryption.json + */ + /** + * Sample code: Get peering with remote virtual network encryption. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getPeeringWithRemoteVirtualNetworkEncryption( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkPeerings() + .getWithResponse("peerTest", "vnet1", "peer", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkPeeringsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkPeeringsListSamples.java new file mode 100644 index 0000000000000..83aab9b6aaa75 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkPeeringsListSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkPeerings List. */ +public final class VirtualNetworkPeeringsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkPeeringList.json + */ + /** + * Sample code: List peerings. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listPeerings(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualNetworkPeerings().list("peerTest", "vnet1", Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkPeeringListWithRemoteVirtualNetworkEncryption.json + */ + /** + * Sample code: List peerings with remote virtual network encryption. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listPeeringsWithRemoteVirtualNetworkEncryption( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualNetworkPeerings().list("peerTest", "vnet1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkTapsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkTapsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..158c814f6fe9b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkTapsCreateOrUpdateSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.NetworkInterfaceIpConfigurationInner; +import com.azure.resourcemanager.network.fluent.models.VirtualNetworkTapInner; + +/** Samples for VirtualNetworkTaps CreateOrUpdate. */ +public final class VirtualNetworkTapsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkTapCreate.json + */ + /** + * Sample code: Create Virtual Network Tap. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createVirtualNetworkTap(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkTaps() + .createOrUpdate( + "rg1", + "test-vtap", + new VirtualNetworkTapInner() + .withLocation("centraluseuap") + .withDestinationNetworkInterfaceIpConfiguration( + new NetworkInterfaceIpConfigurationInner() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/testNetworkInterface/ipConfigurations/ipconfig1")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkTapsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkTapsDeleteSamples.java new file mode 100644 index 0000000000000..516a584a102cb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkTapsDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkTaps Delete. */ +public final class VirtualNetworkTapsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkTapDelete.json + */ + /** + * Sample code: Delete Virtual Network Tap resource. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteVirtualNetworkTapResource(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualNetworkTaps().delete("rg1", "test-vtap", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkTapsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkTapsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..98da6be13bde5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkTapsGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkTaps GetByResourceGroup. */ +public final class VirtualNetworkTapsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkTapGet.json + */ + /** + * Sample code: Get Virtual Network Tap. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualNetworkTap(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkTaps() + .getByResourceGroupWithResponse("rg1", "testvtap", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkTapsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkTapsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..6940e923762e1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkTapsListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkTaps ListByResourceGroup. */ +public final class VirtualNetworkTapsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkTapList.json + */ + /** + * Sample code: List virtual network taps in resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listVirtualNetworkTapsInResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualNetworkTaps().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkTapsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkTapsListSamples.java new file mode 100644 index 0000000000000..52139bbad269a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkTapsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkTaps List. */ +public final class VirtualNetworkTapsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkTapListAll.json + */ + /** + * Sample code: List all virtual network taps. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllVirtualNetworkTaps(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualNetworkTaps().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkTapsUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkTapsUpdateTagsSamples.java new file mode 100644 index 0000000000000..1cb429a2664df --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworkTapsUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualNetworkTaps UpdateTags. */ +public final class VirtualNetworkTapsUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkTapUpdateTags.json + */ + /** + * Sample code: Update virtual network tap tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateVirtualNetworkTapTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworkTaps() + .updateTagsWithResponse( + "rg1", "test-vtap", new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksCheckIpAddressAvailabilitySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksCheckIpAddressAvailabilitySamples.java new file mode 100644 index 0000000000000..c1300e1c8e261 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksCheckIpAddressAvailabilitySamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworks CheckIpAddressAvailability. */ +public final class VirtualNetworksCheckIpAddressAvailabilitySamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkCheckIPAddressAvailability.json + */ + /** + * Sample code: Check IP address availability. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void checkIPAddressAvailability(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworks() + .checkIpAddressAvailabilityWithResponse("rg1", "test-vnet", "10.0.1.4", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..676d3295a63fc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksCreateOrUpdateSamples.java @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.ServiceEndpointPolicyInner; +import com.azure.resourcemanager.network.fluent.models.SubnetInner; +import com.azure.resourcemanager.network.fluent.models.VirtualNetworkInner; +import com.azure.resourcemanager.network.models.AddressSpace; +import com.azure.resourcemanager.network.models.Delegation; +import com.azure.resourcemanager.network.models.ServiceEndpointPropertiesFormat; +import com.azure.resourcemanager.network.models.VirtualNetworkBgpCommunities; +import com.azure.resourcemanager.network.models.VirtualNetworkEncryption; +import com.azure.resourcemanager.network.models.VirtualNetworkEncryptionEnforcement; +import java.util.Arrays; + +/** Samples for VirtualNetworks CreateOrUpdate. */ +public final class VirtualNetworksCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkCreateSubnet.json + */ + /** + * Sample code: Create virtual network with subnet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createVirtualNetworkWithSubnet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworks() + .createOrUpdate( + "rg1", + "test-vnet", + new VirtualNetworkInner() + .withLocation("eastus") + .withAddressSpace(new AddressSpace().withAddressPrefixes(Arrays.asList("10.0.0.0/16"))) + .withSubnets(Arrays.asList(new SubnetInner().withName("test-1").withAddressPrefix("10.0.0.0/24"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkCreateWithBgpCommunities.json + */ + /** + * Sample code: Create virtual network with Bgp Communities. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createVirtualNetworkWithBgpCommunities(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworks() + .createOrUpdate( + "rg1", + "test-vnet", + new VirtualNetworkInner() + .withLocation("eastus") + .withAddressSpace(new AddressSpace().withAddressPrefixes(Arrays.asList("10.0.0.0/16"))) + .withSubnets(Arrays.asList(new SubnetInner().withName("test-1").withAddressPrefix("10.0.0.0/24"))) + .withBgpCommunities(new VirtualNetworkBgpCommunities().withVirtualNetworkCommunity("12076:20000")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkCreateSubnetWithAddressPrefixes.json + */ + /** + * Sample code: Create virtual network with subnet containing address prefixes. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createVirtualNetworkWithSubnetContainingAddressPrefixes( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworks() + .createOrUpdate( + "rg1", + "test-vnet", + new VirtualNetworkInner() + .withLocation("eastus") + .withAddressSpace(new AddressSpace().withAddressPrefixes(Arrays.asList("10.0.0.0/16"))) + .withSubnets( + Arrays + .asList( + new SubnetInner() + .withName("test-2") + .withAddressPrefixes(Arrays.asList("10.0.0.0/28", "10.0.1.0/28")))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkCreateSubnetWithDelegation.json + */ + /** + * Sample code: Create virtual network with delegated subnets. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createVirtualNetworkWithDelegatedSubnets(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworks() + .createOrUpdate( + "rg1", + "test-vnet", + new VirtualNetworkInner() + .withLocation("westcentralus") + .withAddressSpace(new AddressSpace().withAddressPrefixes(Arrays.asList("10.0.0.0/16"))) + .withSubnets( + Arrays + .asList( + new SubnetInner() + .withName("test-1") + .withAddressPrefix("10.0.0.0/24") + .withDelegations( + Arrays + .asList( + new Delegation() + .withName("myDelegation") + .withServiceName("Microsoft.Sql/managedInstances"))))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkCreateWithEncryption.json + */ + /** + * Sample code: Create virtual network with encryption. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createVirtualNetworkWithEncryption(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworks() + .createOrUpdate( + "rg1", + "test-vnet", + new VirtualNetworkInner() + .withLocation("eastus") + .withAddressSpace(new AddressSpace().withAddressPrefixes(Arrays.asList("10.0.0.0/16"))) + .withSubnets(Arrays.asList(new SubnetInner().withName("test-1").withAddressPrefix("10.0.0.0/24"))) + .withEncryption( + new VirtualNetworkEncryption() + .withEnabled(true) + .withEnforcement(VirtualNetworkEncryptionEnforcement.ALLOW_UNENCRYPTED)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkCreate.json + */ + /** + * Sample code: Create virtual network. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createVirtualNetwork(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworks() + .createOrUpdate( + "rg1", + "test-vnet", + new VirtualNetworkInner() + .withLocation("eastus") + .withAddressSpace(new AddressSpace().withAddressPrefixes(Arrays.asList("10.0.0.0/16"))) + .withFlowTimeoutInMinutes(10), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkCreateServiceEndpointPolicy.json + */ + /** + * Sample code: Create virtual network with service endpoints and service endpoint policy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createVirtualNetworkWithServiceEndpointsAndServiceEndpointPolicy( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworks() + .createOrUpdate( + "vnetTest", + "vnet1", + new VirtualNetworkInner() + .withLocation("eastus2euap") + .withAddressSpace(new AddressSpace().withAddressPrefixes(Arrays.asList("10.0.0.0/16"))) + .withSubnets( + Arrays + .asList( + new SubnetInner() + .withName("test-1") + .withAddressPrefix("10.0.0.0/16") + .withServiceEndpoints( + Arrays + .asList( + new ServiceEndpointPropertiesFormat().withService("Microsoft.Storage"))) + .withServiceEndpointPolicies( + Arrays + .asList( + new ServiceEndpointPolicyInner() + .withId( + "/subscriptions/subid/resourceGroups/vnetTest/providers/Microsoft.Network/serviceEndpointPolicies/ServiceEndpointPolicy1"))))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkCreateServiceEndpoints.json + */ + /** + * Sample code: Create virtual network with service endpoints. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createVirtualNetworkWithServiceEndpoints(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworks() + .createOrUpdate( + "vnetTest", + "vnet1", + new VirtualNetworkInner() + .withLocation("eastus") + .withAddressSpace(new AddressSpace().withAddressPrefixes(Arrays.asList("10.0.0.0/16"))) + .withSubnets( + Arrays + .asList( + new SubnetInner() + .withName("test-1") + .withAddressPrefix("10.0.0.0/16") + .withServiceEndpoints( + Arrays + .asList( + new ServiceEndpointPropertiesFormat() + .withService("Microsoft.Storage"))))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksDeleteSamples.java new file mode 100644 index 0000000000000..595656c6693a5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworks Delete. */ +public final class VirtualNetworksDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkDelete.json + */ + /** + * Sample code: Delete virtual network. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteVirtualNetwork(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualNetworks().delete("rg1", "test-vnet", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..f1fec2f5e0cce --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksGetByResourceGroupSamples.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworks GetByResourceGroup. */ +public final class VirtualNetworksGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGetWithSubnetDelegation.json + */ + /** + * Sample code: Get virtual network with a delegated subnet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualNetworkWithADelegatedSubnet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworks() + .getByResourceGroupWithResponse("rg1", "test-vnet", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGetWithServiceAssociationLink.json + */ + /** + * Sample code: Get virtual network with service association links. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualNetworkWithServiceAssociationLinks( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworks() + .getByResourceGroupWithResponse("rg1", "test-vnet", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkGet.json + */ + /** + * Sample code: Get virtual network. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualNetwork(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworks() + .getByResourceGroupWithResponse("rg1", "test-vnet", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksListByResourceGroupSamples.java new file mode 100644 index 0000000000000..c648c3a3b7277 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksListByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworks ListByResourceGroup. */ +public final class VirtualNetworksListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkList.json + */ + /** + * Sample code: List virtual networks in resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listVirtualNetworksInResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualNetworks().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksListSamples.java new file mode 100644 index 0000000000000..63ed752d88d07 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworks List. */ +public final class VirtualNetworksListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkListAll.json + */ + /** + * Sample code: List all virtual networks. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllVirtualNetworks(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualNetworks().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksListUsageSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksListUsageSamples.java new file mode 100644 index 0000000000000..325bd41e48caa --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksListUsageSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworks ListUsage. */ +public final class VirtualNetworksListUsageSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkListUsage.json + */ + /** + * Sample code: VnetGetUsage. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vnetGetUsage(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualNetworks().listUsage("rg1", "vnetName", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksUpdateTagsSamples.java new file mode 100644 index 0000000000000..2c3bdb5e2b4cf --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualNetworksUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualNetworks UpdateTags. */ +public final class VirtualNetworksUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualNetworkUpdateTags.json + */ + /** + * Sample code: Update virtual network tags. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateVirtualNetworkTags(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualNetworks() + .updateTagsWithResponse( + "rg1", "test-vnet", new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRouterPeeringsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRouterPeeringsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..8d0697072942e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRouterPeeringsCreateOrUpdateSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.VirtualRouterPeeringInner; + +/** Samples for VirtualRouterPeerings CreateOrUpdate. */ +public final class VirtualRouterPeeringsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualRouterPeeringPut.json + */ + /** + * Sample code: Create Virtual Router Peering. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createVirtualRouterPeering(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualRouterPeerings() + .createOrUpdate( + "rg1", + "virtualRouter", + "peering1", + new VirtualRouterPeeringInner().withPeerAsn(20000L).withPeerIp("192.168.1.5"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRouterPeeringsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRouterPeeringsDeleteSamples.java new file mode 100644 index 0000000000000..dc8ec701f017c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRouterPeeringsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualRouterPeerings Delete. */ +public final class VirtualRouterPeeringsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualRouterPeeringDelete.json + */ + /** + * Sample code: Delete VirtualRouterPeering. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteVirtualRouterPeering(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualRouterPeerings() + .delete("rg1", "virtualRouter", "peering1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRouterPeeringsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRouterPeeringsGetSamples.java new file mode 100644 index 0000000000000..265e8cd205967 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRouterPeeringsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualRouterPeerings Get. */ +public final class VirtualRouterPeeringsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualRouterPeeringGet.json + */ + /** + * Sample code: Get Virtual Router Peering. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualRouterPeering(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualRouterPeerings() + .getWithResponse("rg1", "virtualRouter", "peering1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRouterPeeringsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRouterPeeringsListSamples.java new file mode 100644 index 0000000000000..31c3403ef150e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRouterPeeringsListSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualRouterPeerings List. */ +public final class VirtualRouterPeeringsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualRouterPeeringList.json + */ + /** + * Sample code: List all Virtual Router Peerings for a given Virtual Router. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllVirtualRouterPeeringsForAGivenVirtualRouter( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualRouterPeerings() + .list("rg1", "virtualRouter", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRoutersCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRoutersCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..cfc1c7e363bf4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRoutersCreateOrUpdateSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.VirtualRouterInner; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualRouters CreateOrUpdate. */ +public final class VirtualRoutersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualRouterPut.json + */ + /** + * Sample code: Create VirtualRouter. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createVirtualRouter(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualRouters() + .createOrUpdate( + "rg1", + "virtualRouter", + new VirtualRouterInner() + .withLocation("West US") + .withTags(mapOf("key1", "value1")) + .withHostedGateway( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworkGateways/vnetGateway")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRoutersDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRoutersDeleteSamples.java new file mode 100644 index 0000000000000..8b03c554ddc1c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRoutersDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualRouters Delete. */ +public final class VirtualRoutersDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualRouterDelete.json + */ + /** + * Sample code: Delete VirtualRouter. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteVirtualRouter(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualRouters().delete("rg1", "virtualRouter", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRoutersGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRoutersGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..b95b002d08b0a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRoutersGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualRouters GetByResourceGroup. */ +public final class VirtualRoutersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualRouterGet.json + */ + /** + * Sample code: Get VirtualRouter. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualRouter(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualRouters() + .getByResourceGroupWithResponse("rg1", "virtualRouter", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRoutersListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRoutersListByResourceGroupSamples.java new file mode 100644 index 0000000000000..d2a226e95c40e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRoutersListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualRouters ListByResourceGroup. */ +public final class VirtualRoutersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualRouterListByResourceGroup.json + */ + /** + * Sample code: List all Virtual Router for a given resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllVirtualRouterForAGivenResourceGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualRouters().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRoutersListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRoutersListSamples.java new file mode 100644 index 0000000000000..cc49588a1ae68 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualRoutersListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualRouters List. */ +public final class VirtualRoutersListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualRouterListBySubscription.json + */ + /** + * Sample code: List all Virtual Routers for a given subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllVirtualRoutersForAGivenSubscription( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualRouters().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualWansCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualWansCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e8b4a86e8dbd3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualWansCreateOrUpdateSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.VirtualWanInner; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualWans CreateOrUpdate. */ +public final class VirtualWansCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualWANPut.json + */ + /** + * Sample code: VirtualWANCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualWANCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualWans() + .createOrUpdate( + "rg1", + "wan1", + new VirtualWanInner() + .withLocation("West US") + .withTags(mapOf("key1", "value1")) + .withDisableVpnEncryption(false) + .withTypePropertiesType("Basic"), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualWansDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualWansDeleteSamples.java new file mode 100644 index 0000000000000..6139eab93431f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualWansDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualWans Delete. */ +public final class VirtualWansDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualWANDelete.json + */ + /** + * Sample code: VirtualWANDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualWANDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualWans().delete("rg1", "virtualWan1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualWansGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualWansGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..06e8a144f469b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualWansGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualWans GetByResourceGroup. */ +public final class VirtualWansGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualWANGet.json + */ + /** + * Sample code: VirtualWANGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualWANGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualWans() + .getByResourceGroupWithResponse("rg1", "wan1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualWansListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualWansListByResourceGroupSamples.java new file mode 100644 index 0000000000000..cb3c57b8b2ebd --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualWansListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualWans ListByResourceGroup. */ +public final class VirtualWansListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualWANListByResourceGroup.json + */ + /** + * Sample code: VirtualWANListByResourceGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualWANListByResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualWans().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualWansListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualWansListSamples.java new file mode 100644 index 0000000000000..8777fa7add24b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualWansListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualWans List. */ +public final class VirtualWansListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualWANList.json + */ + /** + * Sample code: VirtualWANList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualWANList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVirtualWans().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualWansUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualWansUpdateTagsSamples.java new file mode 100644 index 0000000000000..2e86380f117af --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VirtualWansUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualWans UpdateTags. */ +public final class VirtualWansUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VirtualWANUpdateTags.json + */ + /** + * Sample code: VirtualWANUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void virtualWANUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVirtualWans() + .updateTagsWithResponse( + "rg1", "wan1", new TagsObject().withTags(mapOf("key1", "value1", "key2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnConnectionsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnConnectionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..c0faf4c2f5124 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnConnectionsCreateOrUpdateSamples.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.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.VpnConnectionInner; +import com.azure.resourcemanager.network.fluent.models.VpnSiteLinkConnectionInner; +import com.azure.resourcemanager.network.models.VirtualNetworkGatewayConnectionProtocol; +import com.azure.resourcemanager.network.models.VpnLinkConnectionMode; +import java.util.Arrays; + +/** Samples for VpnConnections CreateOrUpdate. */ +public final class VpnConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnConnectionPut.json + */ + /** + * Sample code: VpnConnectionPut. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnConnectionPut(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnConnections() + .createOrUpdate( + "rg1", + "gateway1", + "vpnConnection1", + new VpnConnectionInner() + .withRemoteVpnSite( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1")) + .withTrafficSelectorPolicies(Arrays.asList()) + .withVpnLinkConnections( + Arrays + .asList( + new VpnSiteLinkConnectionInner() + .withName("Connection-Link1") + .withVpnSiteLink( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink1")) + .withVpnLinkConnectionMode(VpnLinkConnectionMode.DEFAULT) + .withVpnConnectionProtocolType(VirtualNetworkGatewayConnectionProtocol.IKEV2) + .withConnectionBandwidth(200) + .withSharedKey("key") + .withUsePolicyBasedTrafficSelectors(false))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnConnectionsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..ddcba852a1457 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnConnectionsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnConnections Delete. */ +public final class VpnConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnConnectionDelete.json + */ + /** + * Sample code: VpnConnectionDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnConnectionDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnConnections() + .delete("rg1", "gateway1", "vpnConnection1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnConnectionsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnConnectionsGetSamples.java new file mode 100644 index 0000000000000..268df1cd793b6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnConnectionsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnConnections Get. */ +public final class VpnConnectionsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnConnectionGet.json + */ + /** + * Sample code: VpnConnectionGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnConnectionGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnConnections() + .getWithResponse("rg1", "gateway1", "vpnConnection1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnConnectionsListByVpnGatewaySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnConnectionsListByVpnGatewaySamples.java new file mode 100644 index 0000000000000..543cc80493c0e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnConnectionsListByVpnGatewaySamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnConnections ListByVpnGateway. */ +public final class VpnConnectionsListByVpnGatewaySamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnConnectionList.json + */ + /** + * Sample code: VpnConnectionList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnConnectionList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnConnections() + .listByVpnGateway("rg1", "gateway1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnConnectionsStartPacketCaptureSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnConnectionsStartPacketCaptureSamples.java new file mode 100644 index 0000000000000..534e4d05620e9 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnConnectionsStartPacketCaptureSamples.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.VpnConnectionPacketCaptureStartParameters; +import java.util.Arrays; + +/** Samples for VpnConnections StartPacketCapture. */ +public final class VpnConnectionsStartPacketCaptureSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnConnectionStartPacketCaptureFilterData.json + */ + /** + * Sample code: Start packet capture on vpn connection with filter. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void startPacketCaptureOnVpnConnectionWithFilter( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnConnections() + .startPacketCapture( + "rg1", + "gateway1", + "vpnConnection1", + new VpnConnectionPacketCaptureStartParameters() + .withFilterData( + "{'TracingFlags': 11,'MaxPacketBufferSize': 120,'MaxFileSize': 200,'Filters':" + + " [{'SourceSubnets': ['20.1.1.0/24'],'DestinationSubnets': ['10.1.1.0/24'],'SourcePort':" + + " [500],'DestinationPort': [4500],'Protocol': 6,'TcpFlags':" + + " 16,'CaptureSingleDirectionTrafficOnly': true}]}") + .withLinkConnectionNames(Arrays.asList("siteLink1", "siteLink2")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnConnectionStartPacketCapture.json + */ + /** + * Sample code: Start packet capture on vpn connection without filter. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void startPacketCaptureOnVpnConnectionWithoutFilter( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnConnections() + .startPacketCapture( + "rg1", + "gateway1", + "vpnConnection1", + new VpnConnectionPacketCaptureStartParameters() + .withLinkConnectionNames(Arrays.asList("siteLink1", "siteLink2")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnConnectionsStopPacketCaptureSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnConnectionsStopPacketCaptureSamples.java new file mode 100644 index 0000000000000..59e653791b0ec --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnConnectionsStopPacketCaptureSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.VpnConnectionPacketCaptureStopParameters; +import java.util.Arrays; + +/** Samples for VpnConnections StopPacketCapture. */ +public final class VpnConnectionsStopPacketCaptureSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnConnectionStopPacketCapture.json + */ + /** + * Sample code: Start packet capture on vpn connection without filter. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void startPacketCaptureOnVpnConnectionWithoutFilter( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnConnections() + .stopPacketCapture( + "rg1", + "gateway1", + "vpnConnection1", + new VpnConnectionPacketCaptureStopParameters() + .withSasUrl( + "https://teststorage.blob.core.windows.net/?sv=2018-03-28&ss=bfqt&srt=sco&sp=rwdlacup&se=2019-09-13T07:44:05Z&st=2019-09-06T23:44:05Z&spr=https&sig=V1h9D1riltvZMI69d6ihENnFo%2FrCvTqGgjO2lf%2FVBhE%3D") + .withLinkConnectionNames(Arrays.asList("vpnSiteLink1", "vpnSiteLink2")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..4b032bd6e5c48 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysCreateOrUpdateSamples.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.VpnConnectionInner; +import com.azure.resourcemanager.network.fluent.models.VpnGatewayInner; +import com.azure.resourcemanager.network.fluent.models.VpnGatewayNatRuleInner; +import com.azure.resourcemanager.network.fluent.models.VpnSiteLinkConnectionInner; +import com.azure.resourcemanager.network.models.BgpSettings; +import com.azure.resourcemanager.network.models.IpConfigurationBgpPeeringAddress; +import com.azure.resourcemanager.network.models.VirtualNetworkGatewayConnectionProtocol; +import com.azure.resourcemanager.network.models.VpnNatRuleMapping; +import com.azure.resourcemanager.network.models.VpnNatRuleMode; +import com.azure.resourcemanager.network.models.VpnNatRuleType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VpnGateways CreateOrUpdate. */ +public final class VpnGatewaysCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnGatewayPut.json + */ + /** + * Sample code: VpnGatewayPut. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnGatewayPut(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnGateways() + .createOrUpdate( + "rg1", + "gateway1", + new VpnGatewayInner() + .withLocation("westcentralus") + .withTags(mapOf("key1", "value1")) + .withVirtualHub( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1")) + .withConnections( + Arrays + .asList( + new VpnConnectionInner() + .withName("vpnConnection1") + .withRemoteVpnSite( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1")) + .withVpnLinkConnections( + Arrays + .asList( + new VpnSiteLinkConnectionInner() + .withName("Connection-Link1") + .withVpnSiteLink( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/vpnSite1/vpnSiteLinks/siteLink1")) + .withVpnConnectionProtocolType( + VirtualNetworkGatewayConnectionProtocol.IKEV2) + .withConnectionBandwidth(200) + .withSharedKey("key") + .withEgressNatRules( + Arrays + .asList( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnGateways/gateway1/natRules/nat03"))))))) + .withBgpSettings( + new BgpSettings() + .withAsn(65515L) + .withPeerWeight(0) + .withBgpPeeringAddresses( + Arrays + .asList( + new IpConfigurationBgpPeeringAddress() + .withIpconfigurationId("Instance0") + .withCustomBgpIpAddresses(Arrays.asList("169.254.21.5")), + new IpConfigurationBgpPeeringAddress() + .withIpconfigurationId("Instance1") + .withCustomBgpIpAddresses(Arrays.asList("169.254.21.10"))))) + .withEnableBgpRouteTranslationForNat(false) + .withIsRoutingPreferenceInternet(false) + .withNatRules( + Arrays + .asList( + new VpnGatewayNatRuleInner() + .withName("nat03") + .withTypePropertiesType(VpnNatRuleType.STATIC) + .withMode(VpnNatRuleMode.EGRESS_SNAT) + .withInternalMappings( + Arrays.asList(new VpnNatRuleMapping().withAddressSpace("0.0.0.0/26"))) + .withExternalMappings( + Arrays.asList(new VpnNatRuleMapping().withAddressSpace("192.168.0.0/26"))) + .withIpConfigurationId(""))), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysDeleteSamples.java new file mode 100644 index 0000000000000..aa6e7ee106da4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnGateways Delete. */ +public final class VpnGatewaysDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnGatewayDelete.json + */ + /** + * Sample code: VpnGatewayDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnGatewayDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVpnGateways().delete("rg1", "gateway1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..881f72348ef7f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnGateways GetByResourceGroup. */ +public final class VpnGatewaysGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnGatewayGet.json + */ + /** + * Sample code: VpnGatewayGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnGatewayGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnGateways() + .getByResourceGroupWithResponse("rg1", "gateway1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysListByResourceGroupSamples.java new file mode 100644 index 0000000000000..ffd4c144f4c14 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnGateways ListByResourceGroup. */ +public final class VpnGatewaysListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnGatewayListByResourceGroup.json + */ + /** + * Sample code: VpnGatewayListByResourceGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnGatewayListByResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVpnGateways().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysListSamples.java new file mode 100644 index 0000000000000..034d78f0d12ae --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnGateways List. */ +public final class VpnGatewaysListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnGatewayList.json + */ + /** + * Sample code: VpnGatewayListBySubscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnGatewayListBySubscription(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVpnGateways().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysResetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysResetSamples.java new file mode 100644 index 0000000000000..9c6557929be4f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysResetSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnGateways Reset. */ +public final class VpnGatewaysResetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnGatewayReset.json + */ + /** + * Sample code: ResetVpnGateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void resetVpnGateway(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVpnGateways().reset("rg1", "vpngw", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysStartPacketCaptureSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysStartPacketCaptureSamples.java new file mode 100644 index 0000000000000..0858ccc96331a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysStartPacketCaptureSamples.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.VpnGatewayPacketCaptureStartParameters; + +/** Samples for VpnGateways StartPacketCapture. */ +public final class VpnGatewaysStartPacketCaptureSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnGatewayStartPacketCaptureFilterData.json + */ + /** + * Sample code: Start packet capture on vpn gateway with filter. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void startPacketCaptureOnVpnGatewayWithFilter(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnGateways() + .startPacketCapture( + "rg1", + "vpngw", + new VpnGatewayPacketCaptureStartParameters() + .withFilterData( + "{'TracingFlags': 11,'MaxPacketBufferSize': 120,'MaxFileSize': 200,'Filters':" + + " [{'SourceSubnets': ['20.1.1.0/24'],'DestinationSubnets': ['10.1.1.0/24'],'SourcePort':" + + " [500],'DestinationPort': [4500],'Protocol': 6,'TcpFlags':" + + " 16,'CaptureSingleDirectionTrafficOnly': true}]}"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnGatewayStartPacketCapture.json + */ + /** + * Sample code: Start packet capture on vpn gateway without filter. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void startPacketCaptureOnVpnGatewayWithoutFilter( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnGateways() + .startPacketCapture("rg1", "vpngw", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysStopPacketCaptureSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysStopPacketCaptureSamples.java new file mode 100644 index 0000000000000..f006e9ae3bf86 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysStopPacketCaptureSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.VpnGatewayPacketCaptureStopParameters; + +/** Samples for VpnGateways StopPacketCapture. */ +public final class VpnGatewaysStopPacketCaptureSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnGatewayStopPacketCapture.json + */ + /** + * Sample code: Stop packet capture on vpn gateway. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void stopPacketCaptureOnVpnGateway(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnGateways() + .stopPacketCapture( + "rg1", + "vpngw", + new VpnGatewayPacketCaptureStopParameters() + .withSasUrl( + "https://teststorage.blob.core.windows.net/?sv=2018-03-28&ss=bfqt&srt=sco&sp=rwdlacup&se=2019-09-13T07:44:05Z&st=2019-09-06T23:44:05Z&spr=https&sig=V1h9D1riltvZMI69d6ihENnFo%2FrCvTqGgjO2lf%2FVBhE%3D"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysUpdateTagsSamples.java new file mode 100644 index 0000000000000..8b81e26aead04 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnGatewaysUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VpnGateways UpdateTags. */ +public final class VpnGatewaysUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnGatewayUpdateTags.json + */ + /** + * Sample code: VpnGatewayUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnGatewayUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnGateways() + .updateTags( + "rg1", "gateway1", new TagsObject().withTags(mapOf("tag1", "value1", "tag2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnLinkConnectionsGetIkeSasSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnLinkConnectionsGetIkeSasSamples.java new file mode 100644 index 0000000000000..0e329c00f39dc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnLinkConnectionsGetIkeSasSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnLinkConnections GetIkeSas. */ +public final class VpnLinkConnectionsGetIkeSasSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnSiteLinkConnectionGetIkeSas.json + */ + /** + * Sample code: GetVpnLinkConnectionIkeSa. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVpnLinkConnectionIkeSa(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnLinkConnections() + .getIkeSas("rg1", "gateway1", "vpnConnection1", "Connection-Link1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnLinkConnectionsListByVpnConnectionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnLinkConnectionsListByVpnConnectionSamples.java new file mode 100644 index 0000000000000..24d7e5716c237 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnLinkConnectionsListByVpnConnectionSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnLinkConnections ListByVpnConnection. */ +public final class VpnLinkConnectionsListByVpnConnectionSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnSiteLinkConnectionList.json + */ + /** + * Sample code: VpnSiteLinkConnectionList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnSiteLinkConnectionList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnLinkConnections() + .listByVpnConnection("rg1", "gateway1", "vpnConnection1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnLinkConnectionsResetConnectionSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnLinkConnectionsResetConnectionSamples.java new file mode 100644 index 0000000000000..6defbcb29e1af --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnLinkConnectionsResetConnectionSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnLinkConnections ResetConnection. */ +public final class VpnLinkConnectionsResetConnectionSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnSiteLinkConnectionReset.json + */ + /** + * Sample code: ResetVpnLinkConnection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void resetVpnLinkConnection(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnLinkConnections() + .resetConnection("rg1", "gateway1", "vpnConnection1", "Connection-Link1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnServerConfigurationsAssociatedWithVirtualWanListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnServerConfigurationsAssociatedWithVirtualWanListSamples.java new file mode 100644 index 0000000000000..12262f4ccffee --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnServerConfigurationsAssociatedWithVirtualWanListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnServerConfigurationsAssociatedWithVirtualWan List. */ +public final class VpnServerConfigurationsAssociatedWithVirtualWanListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/GetVirtualWanVpnServerConfigurations.json + */ + /** + * Sample code: GetVirtualWanVpnServerConfigurations. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getVirtualWanVpnServerConfigurations(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnServerConfigurationsAssociatedWithVirtualWans() + .list("rg1", "wan1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnServerConfigurationsCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnServerConfigurationsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..4ff3c11d59a33 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnServerConfigurationsCreateOrUpdateSamples.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.VpnServerConfigurationInner; +import com.azure.resourcemanager.network.models.DhGroup; +import com.azure.resourcemanager.network.models.IkeEncryption; +import com.azure.resourcemanager.network.models.IkeIntegrity; +import com.azure.resourcemanager.network.models.IpsecEncryption; +import com.azure.resourcemanager.network.models.IpsecIntegrity; +import com.azure.resourcemanager.network.models.IpsecPolicy; +import com.azure.resourcemanager.network.models.PfsGroup; +import com.azure.resourcemanager.network.models.RadiusServer; +import com.azure.resourcemanager.network.models.VpnGatewayTunnelingProtocol; +import com.azure.resourcemanager.network.models.VpnServerConfigRadiusClientRootCertificate; +import com.azure.resourcemanager.network.models.VpnServerConfigRadiusServerRootCertificate; +import com.azure.resourcemanager.network.models.VpnServerConfigVpnClientRevokedCertificate; +import com.azure.resourcemanager.network.models.VpnServerConfigVpnClientRootCertificate; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VpnServerConfigurations CreateOrUpdate. */ +public final class VpnServerConfigurationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnServerConfigurationPut.json + */ + /** + * Sample code: VpnServerConfigurationCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnServerConfigurationCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnServerConfigurations() + .createOrUpdate( + "rg1", + "vpnServerConfiguration1", + new VpnServerConfigurationInner() + .withLocation("West US") + .withTags(mapOf("key1", "value1")) + .withVpnProtocols(Arrays.asList(VpnGatewayTunnelingProtocol.IKE_V2)) + .withVpnClientRootCertificates( + Arrays + .asList( + new VpnServerConfigVpnClientRootCertificate() + .withName("vpnServerConfigVpnClientRootCert1") + .withPublicCertData( + "MIIC5zCCAc+gAwIBAgIQErQ0Hk4aDJxIA+Q5RagB+jANBgkqhkiG9w0BAQsFADAWMRQwEgYDVQQDDAtQMlNSb290Q2VydDAeFw0xNzEyMTQyMTA3MzhaFw0xODEyMTQyMTI3MzhaMBYxFDASBgNVBAMMC1AyU1Jvb3RDZXJ0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArP7/NQXmW7cQ/ZR1mv3Y3I29Lt7HTOqzo/1KUOoVH3NItbQIRAQbwKy3UWrOFz4eGNX2GWtNRMdCyWsKeqy9Ltsdfcm1IbKXkl84DFeU/ZacXu4Dl3xX3gV5du4TLZjEowJELyur11Ea2YcjPRQ/FzAF9/hGuboS1HZQEPLx4FdUs9OxCYOtc0MxBCwLfVTTRqarb0Ne+arNYd4kCzIhAke1nOyKAJBda5ZL+VHy3S5S8qGlD46jm8HXugmAkUygS4oIIXOmj/1O9sNAi3LN60zufSzCmP8Rm/iUGX+DHAGGiXxwZOKQLEDaZXKqoHjMPP0XudmSWwOIbyeQVrLhkwIDAQABozEwLzAOBgNVHQ8BAf8EBAMCAgQwHQYDVR0OBBYEFEfeNU2trYxNLF9ONmuJUsT13pKDMA0GCSqGSIb3DQEBCwUAA4IBAQBmM6RJzsGGipxyMhimHKN2xlkejhVsgBoTAhOU0llW9aUSwINJ9zFUGgI8IzUFy1VG776fchHp0LMRmPSIUYk5btEPxbsrPtumPuMH8EQGrS+Rt4pD+78c8H1fEPkq5CmDl/PKu4JoFGv+aFcE+Od0hlILstIF10Qysf++QXDolKfzJa/56bgMeYKFiju73loiRM57ns8ddXpfLl792UVpRkFU62LNns6Y1LKTwapmUF4IvIuAIzd6LZNOQng64LAKXtKnViJ1JQiXwf4CEzhgvAti3/ejpb3U90hsrUcyZi6wBv9bZLcAJRWpz61JNYliM1d1grSwQDKGXNQE4xuN"))) + .withVpnClientRevokedCertificates( + Arrays + .asList( + new VpnServerConfigVpnClientRevokedCertificate() + .withName("vpnServerConfigVpnClientRevokedCert1") + .withThumbprint("83FFBFC8848B5A5836C94D0112367E16148A286F"))) + .withRadiusServerRootCertificates( + Arrays + .asList( + new VpnServerConfigRadiusServerRootCertificate() + .withName("vpnServerConfigRadiusServerRootCer1") + .withPublicCertData( + "MIIC5zCCAc+gAwIBAgIQErQ0Hk4aDJxIA+Q5RagB+jANBgkqhkiG9w0BAQsFADAWMRQwEgYDVQQDDAtQMlNSb290Q2VydDAeFw0xNzEyMTQyMTA3MzhaFw0xODEyMTQyMTI3MzhaMBYxFDASBgNVBAMMC1AyU1Jvb3RDZXJ0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArP7/NQXmW7cQ/ZR1mv3Y3I29Lt7HTOqzo/1KUOoVH3NItbQIRAQbwKy3UWrOFz4eGNX2GWtNRMdCyWsKeqy9Ltsdfcm1IbKXkl84DFeU/ZacXu4Dl3xX3gV5du4TLZjEowJELyur11Ea2YcjPRQ/FzAF9/hGuboS1HZQEPLx4FdUs9OxCYOtc0MxBCwLfVTTRqarb0Ne+arNYd4kCzIhAke1nOyKAJBda5ZL+VHy3S5S8qGlD46jm8HXugmAkUygS4oIIXOmj/1O9sNAi3LN60zufSzCmP8Rm/iUGX+DHAGGiXxwZOKQLEDaZXKqoHjMPP0XudmSWwOIbyeQVrLhkwIDAQABozEwLzAOBgNVHQ8BAf8EBAMCAgQwHQYDVR0OBBYEFEfeNU2trYxNLF9ONmuJUsT13pKDMA0GCSqGSIb3DQEBCwUAA4IBAQBmM6RJzsGGipxyMhimHKN2xlkejhVsgBoTAhOU0llW9aUSwINJ9zFUGgI8IzUFy1VG776fchHp0LMRmPSIUYk5btEPxbsrPtumPuMH8EQGrS+Rt4pD+78c8H1fEPkq5CmDl/PKu4JoFGv+aFcE+Od0hlILstIF10Qysf++QXDolKfzJa/56bgMeYKFiju73loiRM57ns8ddXpfLl792UVpRkFU62LNns6Y1LKTwapmUF4IvIuAIzd6LZNOQng64LAKXtKnViJ1JQiXwf4CEzhgvAti3/ejpb3U90hsrUcyZi6wBv9bZLcAJRWpz61JNYliM1d1grSwQDKGXNQE4xuM"))) + .withRadiusClientRootCertificates( + Arrays + .asList( + new VpnServerConfigRadiusClientRootCertificate() + .withName("vpnServerConfigRadiusClientRootCert1") + .withThumbprint("83FFBFC8848B5A5836C94D0112367E16148A286F"))) + .withVpnClientIpsecPolicies( + Arrays + .asList( + new IpsecPolicy() + .withSaLifeTimeSeconds(86472) + .withSaDataSizeKilobytes(429497) + .withIpsecEncryption(IpsecEncryption.AES256) + .withIpsecIntegrity(IpsecIntegrity.SHA256) + .withIkeEncryption(IkeEncryption.AES256) + .withIkeIntegrity(IkeIntegrity.SHA384) + .withDhGroup(DhGroup.DHGROUP14) + .withPfsGroup(PfsGroup.PFS14))) + .withRadiusServers( + Arrays + .asList( + new RadiusServer() + .withRadiusServerAddress("10.0.0.0") + .withRadiusServerScore(25L) + .withRadiusServerSecret("radiusServerSecret"))), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnServerConfigurationsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnServerConfigurationsDeleteSamples.java new file mode 100644 index 0000000000000..586232249e394 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnServerConfigurationsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnServerConfigurations Delete. */ +public final class VpnServerConfigurationsDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnServerConfigurationDelete.json + */ + /** + * Sample code: VpnServerConfigurationDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnServerConfigurationDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnServerConfigurations() + .delete("rg1", "vpnServerConfiguration1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnServerConfigurationsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnServerConfigurationsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..2e608bdc2d52f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnServerConfigurationsGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnServerConfigurations GetByResourceGroup. */ +public final class VpnServerConfigurationsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnServerConfigurationGet.json + */ + /** + * Sample code: VpnServerConfigurationGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnServerConfigurationGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnServerConfigurations() + .getByResourceGroupWithResponse("rg1", "vpnServerConfiguration1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnServerConfigurationsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnServerConfigurationsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..593458b44f2d1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnServerConfigurationsListByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnServerConfigurations ListByResourceGroup. */ +public final class VpnServerConfigurationsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnServerConfigurationListByResourceGroup.json + */ + /** + * Sample code: VpnServerConfigurationListByResourceGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnServerConfigurationListByResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnServerConfigurations() + .listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnServerConfigurationsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnServerConfigurationsListSamples.java new file mode 100644 index 0000000000000..b948b5015658b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnServerConfigurationsListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnServerConfigurations List. */ +public final class VpnServerConfigurationsListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnServerConfigurationList.json + */ + /** + * Sample code: VpnServerConfigurationList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnServerConfigurationList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVpnServerConfigurations().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnServerConfigurationsUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnServerConfigurationsUpdateTagsSamples.java new file mode 100644 index 0000000000000..04e327c6b8524 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnServerConfigurationsUpdateTagsSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VpnServerConfigurations UpdateTags. */ +public final class VpnServerConfigurationsUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnServerConfigurationUpdateTags.json + */ + /** + * Sample code: VpnServerConfigurationUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnServerConfigurationUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnServerConfigurations() + .updateTagsWithResponse( + "rg1", + "vpnServerConfiguration1", + new TagsObject().withTags(mapOf("key1", "value1", "key2", "value2")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSiteLinkConnectionsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSiteLinkConnectionsGetSamples.java new file mode 100644 index 0000000000000..4a5473a2a256f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSiteLinkConnectionsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnSiteLinkConnections Get. */ +public final class VpnSiteLinkConnectionsGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnSiteLinkConnectionGet.json + */ + /** + * Sample code: VpnSiteLinkConnectionGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnSiteLinkConnectionGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnSiteLinkConnections() + .getWithResponse("rg1", "gateway1", "vpnConnection1", "Connection-Link1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSiteLinksGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSiteLinksGetSamples.java new file mode 100644 index 0000000000000..c3f3f3df20144 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSiteLinksGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnSiteLinks Get. */ +public final class VpnSiteLinksGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnSiteLinkGet.json + */ + /** + * Sample code: VpnSiteGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnSiteGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnSiteLinks() + .getWithResponse("rg1", "vpnSite1", "vpnSiteLink1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSiteLinksListByVpnSiteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSiteLinksListByVpnSiteSamples.java new file mode 100644 index 0000000000000..2290003864b81 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSiteLinksListByVpnSiteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnSiteLinks ListByVpnSite. */ +public final class VpnSiteLinksListByVpnSiteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnSiteLinkListByVpnSite.json + */ + /** + * Sample code: VpnSiteLinkListByVpnSite. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnSiteLinkListByVpnSite(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVpnSiteLinks().listByVpnSite("rg1", "vpnSite1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSitesConfigurationDownloadSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSitesConfigurationDownloadSamples.java new file mode 100644 index 0000000000000..d325af444ea2d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSitesConfigurationDownloadSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.GetVpnSitesConfigurationRequest; +import java.util.Arrays; + +/** Samples for VpnSitesConfiguration Download. */ +public final class VpnSitesConfigurationDownloadSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnSitesConfigurationDownload.json + */ + /** + * Sample code: VpnSitesConfigurationDownload. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnSitesConfigurationDownload(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnSitesConfigurations() + .download( + "rg1", + "wan1", + new GetVpnSitesConfigurationRequest() + .withVpnSites( + Arrays + .asList("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/vpnSites/abc")) + .withOutputBlobSasUrl( + "https://blobcortextesturl.blob.core.windows.net/folderforconfig/vpnFile?sp=rw&se=2018-01-10T03%3A42%3A04Z&sv=2017-04-17&sig=WvXrT5bDmDFfgHs%2Brz%2BjAu123eRCNE9BO0eQYcPDT7pY%3D&sr=b"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSitesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSitesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..ce92414a04198 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSitesCreateOrUpdateSamples.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.network.generated; + +import com.azure.core.management.SubResource; +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.VpnSiteInner; +import com.azure.resourcemanager.network.fluent.models.VpnSiteLinkInner; +import com.azure.resourcemanager.network.models.AddressSpace; +import com.azure.resourcemanager.network.models.O365BreakOutCategoryPolicies; +import com.azure.resourcemanager.network.models.O365PolicyProperties; +import com.azure.resourcemanager.network.models.VpnLinkBgpSettings; +import com.azure.resourcemanager.network.models.VpnLinkProviderProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VpnSites CreateOrUpdate. */ +public final class VpnSitesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnSitePut.json + */ + /** + * Sample code: VpnSiteCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnSiteCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnSites() + .createOrUpdate( + "rg1", + "vpnSite1", + new VpnSiteInner() + .withLocation("West US") + .withTags(mapOf("key1", "value1")) + .withVirtualWan( + new SubResource() + .withId( + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualWANs/wan1")) + .withAddressSpace(new AddressSpace().withAddressPrefixes(Arrays.asList("10.0.0.0/16"))) + .withIsSecuritySite(false) + .withVpnSiteLinks( + Arrays + .asList( + new VpnSiteLinkInner() + .withName("vpnSiteLink1") + .withLinkProperties( + new VpnLinkProviderProperties() + .withLinkProviderName("vendor1") + .withLinkSpeedInMbps(0)) + .withIpAddress("50.50.50.56") + .withFqdn("link1.vpnsite1.contoso.com") + .withBgpProperties( + new VpnLinkBgpSettings().withAsn(1234L).withBgpPeeringAddress("192.168.0.0")))) + .withO365Policy( + new O365PolicyProperties() + .withBreakOutCategories( + new O365BreakOutCategoryPolicies() + .withAllow(true) + .withOptimize(true) + .withDefaultProperty(false))), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSitesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSitesDeleteSamples.java new file mode 100644 index 0000000000000..a010aede8e4af --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSitesDeleteSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnSites Delete. */ +public final class VpnSitesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnSiteDelete.json + */ + /** + * Sample code: VpnSiteDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnSiteDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVpnSites().delete("rg1", "vpnSite1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSitesGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSitesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..47d07c54b5ab0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSitesGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnSites GetByResourceGroup. */ +public final class VpnSitesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnSiteGet.json + */ + /** + * Sample code: VpnSiteGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnSiteGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnSites() + .getByResourceGroupWithResponse("rg1", "vpnSite1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSitesListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSitesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..7952826eb28ac --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSitesListByResourceGroupSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnSites ListByResourceGroup. */ +public final class VpnSitesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnSiteListByResourceGroup.json + */ + /** + * Sample code: VpnSiteListByResourceGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnSiteListByResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVpnSites().listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSitesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSitesListSamples.java new file mode 100644 index 0000000000000..29c502e528476 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSitesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for VpnSites List. */ +public final class VpnSitesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnSiteList.json + */ + /** + * Sample code: VpnSiteList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnSiteList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getVpnSites().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSitesUpdateTagsSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSitesUpdateTagsSamples.java new file mode 100644 index 0000000000000..f0f72024e8bd0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnSitesUpdateTagsSamples.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.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.models.TagsObject; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VpnSites UpdateTags. */ +public final class VpnSitesUpdateTagsSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/VpnSiteUpdateTags.json + */ + /** + * Sample code: VpnSiteUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void vpnSiteUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getVpnSites() + .updateTagsWithResponse( + "rg1", "vpnSite1", new TagsObject().withTags(mapOf("key1", "value1", "key2", "value2")), 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/WebApplicationFirewallPoliciesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/WebApplicationFirewallPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..f3d12c2fe6408 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/WebApplicationFirewallPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.network.fluent.models.WebApplicationFirewallPolicyInner; +import com.azure.resourcemanager.network.models.ExclusionManagedRule; +import com.azure.resourcemanager.network.models.ExclusionManagedRuleGroup; +import com.azure.resourcemanager.network.models.ExclusionManagedRuleSet; +import com.azure.resourcemanager.network.models.ManagedRuleSet; +import com.azure.resourcemanager.network.models.ManagedRulesDefinition; +import com.azure.resourcemanager.network.models.MatchCondition; +import com.azure.resourcemanager.network.models.MatchVariable; +import com.azure.resourcemanager.network.models.OwaspCrsExclusionEntry; +import com.azure.resourcemanager.network.models.OwaspCrsExclusionEntryMatchVariable; +import com.azure.resourcemanager.network.models.OwaspCrsExclusionEntrySelectorMatchOperator; +import com.azure.resourcemanager.network.models.WebApplicationFirewallAction; +import com.azure.resourcemanager.network.models.WebApplicationFirewallCustomRule; +import com.azure.resourcemanager.network.models.WebApplicationFirewallMatchVariable; +import com.azure.resourcemanager.network.models.WebApplicationFirewallOperator; +import com.azure.resourcemanager.network.models.WebApplicationFirewallRuleType; +import java.util.Arrays; + +/** Samples for WebApplicationFirewallPolicies CreateOrUpdate. */ +public final class WebApplicationFirewallPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/WafPolicyCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates a WAF policy within a resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createsOrUpdatesAWAFPolicyWithinAResourceGroup( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getWebApplicationFirewallPolicies() + .createOrUpdateWithResponse( + "rg1", + "Policy1", + new WebApplicationFirewallPolicyInner() + .withLocation("WestUs") + .withCustomRules( + Arrays + .asList( + new WebApplicationFirewallCustomRule() + .withName("Rule1") + .withPriority(1) + .withRuleType(WebApplicationFirewallRuleType.MATCH_RULE) + .withMatchConditions( + Arrays + .asList( + new MatchCondition() + .withMatchVariables( + Arrays + .asList( + new MatchVariable() + .withVariableName( + WebApplicationFirewallMatchVariable + .REMOTE_ADDR))) + .withOperator(WebApplicationFirewallOperator.IPMATCH) + .withMatchValues(Arrays.asList("192.168.1.0/24", "10.0.0.0/24")))) + .withAction(WebApplicationFirewallAction.BLOCK), + new WebApplicationFirewallCustomRule() + .withName("Rule2") + .withPriority(2) + .withRuleType(WebApplicationFirewallRuleType.MATCH_RULE) + .withMatchConditions( + Arrays + .asList( + new MatchCondition() + .withMatchVariables( + Arrays + .asList( + new MatchVariable() + .withVariableName( + WebApplicationFirewallMatchVariable + .REMOTE_ADDR))) + .withOperator(WebApplicationFirewallOperator.IPMATCH) + .withMatchValues(Arrays.asList("192.168.1.0/24")), + new MatchCondition() + .withMatchVariables( + Arrays + .asList( + new MatchVariable() + .withVariableName( + WebApplicationFirewallMatchVariable + .REQUEST_HEADERS) + .withSelector("UserAgent"))) + .withOperator(WebApplicationFirewallOperator.CONTAINS) + .withMatchValues(Arrays.asList("Windows")))) + .withAction(WebApplicationFirewallAction.BLOCK))) + .withManagedRules( + new ManagedRulesDefinition() + .withExclusions( + Arrays + .asList( + new OwaspCrsExclusionEntry() + .withMatchVariable(OwaspCrsExclusionEntryMatchVariable.REQUEST_ARG_NAMES) + .withSelectorMatchOperator( + OwaspCrsExclusionEntrySelectorMatchOperator.STARTS_WITH) + .withSelector("hello") + .withExclusionManagedRuleSets( + Arrays + .asList( + new ExclusionManagedRuleSet() + .withRuleSetType("OWASP") + .withRuleSetVersion("3.2") + .withRuleGroups( + Arrays + .asList( + new ExclusionManagedRuleGroup() + .withRuleGroupName( + "REQUEST-930-APPLICATION-ATTACK-LFI") + .withRules( + Arrays + .asList( + new ExclusionManagedRule() + .withRuleId("930120"))), + new ExclusionManagedRuleGroup() + .withRuleGroupName( + "REQUEST-932-APPLICATION-ATTACK-RCE"))))), + new OwaspCrsExclusionEntry() + .withMatchVariable(OwaspCrsExclusionEntryMatchVariable.REQUEST_ARG_NAMES) + .withSelectorMatchOperator( + OwaspCrsExclusionEntrySelectorMatchOperator.ENDS_WITH) + .withSelector("hello") + .withExclusionManagedRuleSets( + Arrays + .asList( + new ExclusionManagedRuleSet() + .withRuleSetType("OWASP") + .withRuleSetVersion("3.1") + .withRuleGroups(Arrays.asList()))), + new OwaspCrsExclusionEntry() + .withMatchVariable(OwaspCrsExclusionEntryMatchVariable.REQUEST_ARG_NAMES) + .withSelectorMatchOperator( + OwaspCrsExclusionEntrySelectorMatchOperator.STARTS_WITH) + .withSelector("test"), + new OwaspCrsExclusionEntry() + .withMatchVariable(OwaspCrsExclusionEntryMatchVariable.REQUEST_ARG_VALUES) + .withSelectorMatchOperator( + OwaspCrsExclusionEntrySelectorMatchOperator.STARTS_WITH) + .withSelector("test"))) + .withManagedRuleSets( + Arrays + .asList(new ManagedRuleSet().withRuleSetType("OWASP").withRuleSetVersion("3.2")))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/WebApplicationFirewallPoliciesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/WebApplicationFirewallPoliciesDeleteSamples.java new file mode 100644 index 0000000000000..a5909b30bc442 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/WebApplicationFirewallPoliciesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for WebApplicationFirewallPolicies Delete. */ +public final class WebApplicationFirewallPoliciesDeleteSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/WafPolicyDelete.json + */ + /** + * Sample code: Deletes a WAF policy within a resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deletesAWAFPolicyWithinAResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getWebApplicationFirewallPolicies() + .delete("rg1", "Policy1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/WebApplicationFirewallPoliciesGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/WebApplicationFirewallPoliciesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..3039533d624ea --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/WebApplicationFirewallPoliciesGetByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for WebApplicationFirewallPolicies GetByResourceGroup. */ +public final class WebApplicationFirewallPoliciesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/WafPolicyGet.json + */ + /** + * Sample code: Gets a WAF policy within a resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getsAWAFPolicyWithinAResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getWebApplicationFirewallPolicies() + .getByResourceGroupWithResponse("rg1", "Policy1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/WebApplicationFirewallPoliciesListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/WebApplicationFirewallPoliciesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..33bf9e2410b2a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/WebApplicationFirewallPoliciesListByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.network.generated; + +import com.azure.core.util.Context; + +/** Samples for WebApplicationFirewallPolicies ListByResourceGroup. */ +public final class WebApplicationFirewallPoliciesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/WafListPolicies.json + */ + /** + * Sample code: Lists all WAF policies in a resource group. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listsAllWAFPoliciesInAResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .networks() + .manager() + .serviceClient() + .getWebApplicationFirewallPolicies() + .listByResourceGroup("rg1", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/WebApplicationFirewallPoliciesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/WebApplicationFirewallPoliciesListSamples.java new file mode 100644 index 0000000000000..ca9d634f9629f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/WebApplicationFirewallPoliciesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for WebApplicationFirewallPolicies List. */ +public final class WebApplicationFirewallPoliciesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/WafListAllPolicies.json + */ + /** + * Sample code: Lists all WAF policies in a subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listsAllWAFPoliciesInASubscription(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getWebApplicationFirewallPolicies().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/WebCategoriesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/WebCategoriesGetSamples.java new file mode 100644 index 0000000000000..124316a8cb3ab --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/WebCategoriesGetSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for WebCategories Get. */ +public final class WebCategoriesGetSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AzureWebCategoryGet.json + */ + /** + * Sample code: Get Azure Web Category by name. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getAzureWebCategoryByName(com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getWebCategories().getWithResponse("Arts", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/WebCategoriesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/WebCategoriesListSamples.java new file mode 100644 index 0000000000000..6cad9eec2b9a6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/WebCategoriesListSamples.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.network.generated; + +import com.azure.core.util.Context; + +/** Samples for WebCategories List. */ +public final class WebCategoriesListSamples { + /* + * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2021-05-01/examples/AzureWebCategoriesListBySubscription.json + */ + /** + * Sample code: List all Azure Web Categories for a given subscription. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listAllAzureWebCategoriesForAGivenSubscription( + com.azure.resourcemanager.AzureResourceManager azure) { + azure.networks().manager().serviceClient().getWebCategories().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersClearLegalHoldSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersClearLegalHoldSamples.java new file mode 100644 index 0000000000000..a78abb7f940ad --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersClearLegalHoldSamples.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.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.fluent.models.LegalHoldInner; +import java.util.Arrays; + +/** Samples for BlobContainers ClearLegalHold. */ +public final class BlobContainersClearLegalHoldSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/BlobContainersClearLegalHold.json + */ + /** + * Sample code: ClearLegalHoldContainers. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void clearLegalHoldContainers(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobContainers() + .clearLegalHoldWithResponse( + "res4303", + "sto7280", + "container8723", + new LegalHoldInner().withTags(Arrays.asList("tag1", "tag2", "tag3")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersCreateOrUpdateImmutabilityPolicySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersCreateOrUpdateImmutabilityPolicySamples.java new file mode 100644 index 0000000000000..613d1ac8798ff --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersCreateOrUpdateImmutabilityPolicySamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.fluent.models.ImmutabilityPolicyInner; + +/** Samples for BlobContainers CreateOrUpdateImmutabilityPolicy. */ +public final class BlobContainersCreateOrUpdateImmutabilityPolicySamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/BlobContainersPutImmutabilityPolicy.json + */ + /** + * Sample code: CreateOrUpdateImmutabilityPolicy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createOrUpdateImmutabilityPolicy(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobContainers() + .createOrUpdateImmutabilityPolicyWithResponse( + "res1782", + "sto7069", + "container6397", + null, + new ImmutabilityPolicyInner() + .withImmutabilityPeriodSinceCreationInDays(3) + .withAllowProtectedAppendWrites(true), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersCreateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersCreateSamples.java new file mode 100644 index 0000000000000..86e13e4274ea0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersCreateSamples.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.fluent.models.BlobContainerInner; +import com.azure.resourcemanager.storage.models.ImmutableStorageWithVersioning; + +/** Samples for BlobContainers Create. */ +public final class BlobContainersCreateSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/BlobContainersPutDefaultEncryptionScope.json + */ + /** + * Sample code: PutContainerWithDefaultEncryptionScope. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void putContainerWithDefaultEncryptionScope(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobContainers() + .createWithResponse( + "res3376", + "sto328", + "container6185", + new BlobContainerInner() + .withDefaultEncryptionScope("encryptionscope185") + .withDenyEncryptionScopeOverride(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/BlobContainersPutObjectLevelWorm.json + */ + /** + * Sample code: PutContainerWithObjectLevelWorm. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void putContainerWithObjectLevelWorm(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobContainers() + .createWithResponse( + "res3376", + "sto328", + "container6185", + new BlobContainerInner() + .withImmutableStorageWithVersioning(new ImmutableStorageWithVersioning().withEnabled(true)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/BlobContainersPut.json + */ + /** + * Sample code: PutContainers. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void putContainers(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobContainers() + .createWithResponse("res3376", "sto328", "container6185", new BlobContainerInner(), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersDeleteImmutabilityPolicySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersDeleteImmutabilityPolicySamples.java new file mode 100644 index 0000000000000..88b3945de93e2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersDeleteImmutabilityPolicySamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for BlobContainers DeleteImmutabilityPolicy. */ +public final class BlobContainersDeleteImmutabilityPolicySamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/BlobContainersDeleteImmutabilityPolicy.json + */ + /** + * Sample code: DeleteImmutabilityPolicy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteImmutabilityPolicy(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobContainers() + .deleteImmutabilityPolicyWithResponse( + "res1581", "sto9621", "container4910", "\"8d59f81a7fa7be0\"", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersDeleteSamples.java new file mode 100644 index 0000000000000..681aca2df7cdd --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for BlobContainers Delete. */ +public final class BlobContainersDeleteSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/BlobContainersDelete.json + */ + /** + * Sample code: DeleteContainers. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteContainers(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobContainers() + .deleteWithResponse("res4079", "sto4506", "container9689", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersExtendImmutabilityPolicySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersExtendImmutabilityPolicySamples.java new file mode 100644 index 0000000000000..22a3fe947d204 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersExtendImmutabilityPolicySamples.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.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.fluent.models.ImmutabilityPolicyInner; + +/** Samples for BlobContainers ExtendImmutabilityPolicy. */ +public final class BlobContainersExtendImmutabilityPolicySamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/BlobContainersExtendImmutabilityPolicy.json + */ + /** + * Sample code: ExtendImmutabilityPolicy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void extendImmutabilityPolicy(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobContainers() + .extendImmutabilityPolicyWithResponse( + "res6238", + "sto232", + "container5023", + "\"8d59f830d0c3bf9\"", + new ImmutabilityPolicyInner().withImmutabilityPeriodSinceCreationInDays(100), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersGetImmutabilityPolicySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersGetImmutabilityPolicySamples.java new file mode 100644 index 0000000000000..1447b3b2abde7 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersGetImmutabilityPolicySamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for BlobContainers GetImmutabilityPolicy. */ +public final class BlobContainersGetImmutabilityPolicySamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/BlobContainersGetImmutabilityPolicy.json + */ + /** + * Sample code: GetImmutabilityPolicy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getImmutabilityPolicy(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobContainers() + .getImmutabilityPolicyWithResponse("res5221", "sto9177", "container3489", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersGetSamples.java new file mode 100644 index 0000000000000..23d156fb2560e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for BlobContainers Get. */ +public final class BlobContainersGetSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/BlobContainersGet.json + */ + /** + * Sample code: GetContainers. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getContainers(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobContainers() + .getWithResponse("res9871", "sto6217", "container1634", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersLeaseSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersLeaseSamples.java new file mode 100644 index 0000000000000..2ed785e7d776c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersLeaseSamples.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.models.LeaseContainerRequest; +import com.azure.resourcemanager.storage.models.LeaseContainerRequestAction; + +/** Samples for BlobContainers Lease. */ +public final class BlobContainersLeaseSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/BlobContainersLease_Break.json + */ + /** + * Sample code: Break a lease on a container. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void breakALeaseOnAContainer(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobContainers() + .leaseWithResponse( + "res3376", + "sto328", + "container6185", + new LeaseContainerRequest() + .withAction(LeaseContainerRequestAction.BREAK) + .withLeaseId("8698f513-fa75-44a1-b8eb-30ba336af27d"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/BlobContainersLease_Acquire.json + */ + /** + * Sample code: Acquire a lease on a container. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void acquireALeaseOnAContainer(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobContainers() + .leaseWithResponse( + "res3376", + "sto328", + "container6185", + new LeaseContainerRequest().withAction(LeaseContainerRequestAction.ACQUIRE).withLeaseDuration(-1), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersListSamples.java new file mode 100644 index 0000000000000..12d826780bfe4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersListSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.models.ListContainersInclude; + +/** Samples for BlobContainers List. */ +public final class BlobContainersListSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/BlobContainersList.json + */ + /** + * Sample code: ListContainers. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listContainers(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobContainers() + .list("res9290", "sto1590", null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/DeletedBlobContainersList.json + */ + /** + * Sample code: ListDeletedContainers. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listDeletedContainers(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobContainers() + .list("res9290", "sto1590", null, null, ListContainersInclude.DELETED, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersLockImmutabilityPolicySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersLockImmutabilityPolicySamples.java new file mode 100644 index 0000000000000..98b8f5fcdddca --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersLockImmutabilityPolicySamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for BlobContainers LockImmutabilityPolicy. */ +public final class BlobContainersLockImmutabilityPolicySamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/BlobContainersLockImmutabilityPolicy.json + */ + /** + * Sample code: LockImmutabilityPolicy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void lockImmutabilityPolicy(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobContainers() + .lockImmutabilityPolicyWithResponse( + "res2702", "sto5009", "container1631", "\"8d59f825b721dd3\"", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersObjectLevelWormSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersObjectLevelWormSamples.java new file mode 100644 index 0000000000000..70104da473f97 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersObjectLevelWormSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for BlobContainers ObjectLevelWorm. */ +public final class BlobContainersObjectLevelWormSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/ObjectLevelWormContainerMigration.json + */ + /** + * Sample code: VersionLevelWormContainerMigration. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void versionLevelWormContainerMigration(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobContainers() + .objectLevelWorm("res1782", "sto7069", "container6397", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersSetLegalHoldSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersSetLegalHoldSamples.java new file mode 100644 index 0000000000000..0183229cd5dbd --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersSetLegalHoldSamples.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.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.fluent.models.LegalHoldInner; +import java.util.Arrays; + +/** Samples for BlobContainers SetLegalHold. */ +public final class BlobContainersSetLegalHoldSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/BlobContainersSetLegalHold.json + */ + /** + * Sample code: SetLegalHoldContainers. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void setLegalHoldContainers(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobContainers() + .setLegalHoldWithResponse( + "res4303", + "sto7280", + "container8723", + new LegalHoldInner().withTags(Arrays.asList("tag1", "tag2", "tag3")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersUpdateSamples.java new file mode 100644 index 0000000000000..ec043506246e5 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobContainersUpdateSamples.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.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.fluent.models.BlobContainerInner; +import com.azure.resourcemanager.storage.models.PublicAccess; +import java.util.HashMap; +import java.util.Map; + +/** Samples for BlobContainers Update. */ +public final class BlobContainersUpdateSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/BlobContainersPatch.json + */ + /** + * Sample code: UpdateContainers. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateContainers(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobContainers() + .updateWithResponse( + "res3376", + "sto328", + "container6185", + new BlobContainerInner() + .withPublicAccess(PublicAccess.CONTAINER) + .withMetadata(mapOf("metadata", "true")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobInventoryPoliciesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobInventoryPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..36e72ea852519 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobInventoryPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.fluent.models.BlobInventoryPolicyInner; +import com.azure.resourcemanager.storage.models.BlobInventoryPolicyDefinition; +import com.azure.resourcemanager.storage.models.BlobInventoryPolicyFilter; +import com.azure.resourcemanager.storage.models.BlobInventoryPolicyName; +import com.azure.resourcemanager.storage.models.BlobInventoryPolicyRule; +import com.azure.resourcemanager.storage.models.BlobInventoryPolicySchema; +import com.azure.resourcemanager.storage.models.Format; +import com.azure.resourcemanager.storage.models.InventoryRuleType; +import com.azure.resourcemanager.storage.models.ObjectType; +import com.azure.resourcemanager.storage.models.Schedule; +import java.util.Arrays; + +/** Samples for BlobInventoryPolicies CreateOrUpdate. */ +public final class BlobInventoryPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountSetBlobInventoryPolicy.json + */ + /** + * Sample code: StorageAccountSetBlobInventoryPolicy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountSetBlobInventoryPolicy(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobInventoryPolicies() + .createOrUpdateWithResponse( + "res7687", + "sto9699", + BlobInventoryPolicyName.DEFAULT, + new BlobInventoryPolicyInner() + .withPolicy( + new BlobInventoryPolicySchema() + .withEnabled(true) + .withType(InventoryRuleType.INVENTORY) + .withRules( + Arrays + .asList( + new BlobInventoryPolicyRule() + .withEnabled(true) + .withName("inventoryPolicyRule1") + .withDestination("container1") + .withDefinition( + new BlobInventoryPolicyDefinition() + .withFilters( + new BlobInventoryPolicyFilter() + .withPrefixMatch( + Arrays.asList("inventoryprefix1", "inventoryprefix2")) + .withBlobTypes( + Arrays.asList("blockBlob", "appendBlob", "pageBlob")) + .withIncludeBlobVersions(true) + .withIncludeSnapshots(true)) + .withFormat(Format.CSV) + .withSchedule(Schedule.DAILY) + .withObjectType(ObjectType.BLOB) + .withSchemaFields( + Arrays + .asList( + "Name", + "Creation-Time", + "Last-Modified", + "Content-Length", + "Content-MD5", + "BlobType", + "AccessTier", + "AccessTierChangeTime", + "Snapshot", + "VersionId", + "IsCurrentVersion", + "Metadata"))), + new BlobInventoryPolicyRule() + .withEnabled(true) + .withName("inventoryPolicyRule2") + .withDestination("container2") + .withDefinition( + new BlobInventoryPolicyDefinition() + .withFormat(Format.PARQUET) + .withSchedule(Schedule.WEEKLY) + .withObjectType(ObjectType.CONTAINER) + .withSchemaFields( + Arrays + .asList( + "Name", + "Last-Modified", + "Metadata", + "LeaseStatus", + "LeaseState", + "LeaseDuration", + "PublicAccess", + "HasImmutabilityPolicy", + "HasLegalHold")))))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobInventoryPoliciesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobInventoryPoliciesDeleteSamples.java new file mode 100644 index 0000000000000..a76841cba5d35 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobInventoryPoliciesDeleteSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.models.BlobInventoryPolicyName; + +/** Samples for BlobInventoryPolicies Delete. */ +public final class BlobInventoryPoliciesDeleteSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountDeleteBlobInventoryPolicy.json + */ + /** + * Sample code: StorageAccountDeleteBlobInventoryPolicy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountDeleteBlobInventoryPolicy(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobInventoryPolicies() + .deleteWithResponse("res6977", "sto2527", BlobInventoryPolicyName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobInventoryPoliciesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobInventoryPoliciesGetSamples.java new file mode 100644 index 0000000000000..d475ea5b2e2c7 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobInventoryPoliciesGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.models.BlobInventoryPolicyName; + +/** Samples for BlobInventoryPolicies Get. */ +public final class BlobInventoryPoliciesGetSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountGetBlobInventoryPolicy.json + */ + /** + * Sample code: StorageAccountGetBlobInventoryPolicy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountGetBlobInventoryPolicy(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobInventoryPolicies() + .getWithResponse("res7687", "sto9699", BlobInventoryPolicyName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobInventoryPoliciesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobInventoryPoliciesListSamples.java new file mode 100644 index 0000000000000..5daaa3015bb36 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobInventoryPoliciesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for BlobInventoryPolicies List. */ +public final class BlobInventoryPoliciesListSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountListBlobInventoryPolicy.json + */ + /** + * Sample code: StorageAccountGetBlobInventoryPolicy. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountGetBlobInventoryPolicy(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobInventoryPolicies() + .list("res7687", "sto9699", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobServicesGetServicePropertiesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobServicesGetServicePropertiesSamples.java new file mode 100644 index 0000000000000..6de17f05ccbfa --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobServicesGetServicePropertiesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for BlobServices GetServiceProperties. */ +public final class BlobServicesGetServicePropertiesSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/BlobServicesGet.json + */ + /** + * Sample code: GetBlobServices. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getBlobServices(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobServices() + .getServicePropertiesWithResponse("res4410", "sto8607", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobServicesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobServicesListSamples.java new file mode 100644 index 0000000000000..c1a00806ead4c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobServicesListSamples.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.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for BlobServices List. */ +public final class BlobServicesListSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/BlobServicesList.json + */ + /** + * Sample code: ListBlobServices. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listBlobServices(com.azure.resourcemanager.AzureResourceManager azure) { + azure.storageAccounts().manager().serviceClient().getBlobServices().list("res4410", "sto8607", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobServicesSetServicePropertiesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobServicesSetServicePropertiesSamples.java new file mode 100644 index 0000000000000..db34edc12a0a6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/BlobServicesSetServicePropertiesSamples.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.fluent.models.BlobServicePropertiesInner; +import com.azure.resourcemanager.storage.models.ChangeFeed; +import com.azure.resourcemanager.storage.models.CorsRule; +import com.azure.resourcemanager.storage.models.CorsRuleAllowedMethodsItem; +import com.azure.resourcemanager.storage.models.CorsRules; +import com.azure.resourcemanager.storage.models.DeleteRetentionPolicy; +import com.azure.resourcemanager.storage.models.LastAccessTimeTrackingPolicy; +import com.azure.resourcemanager.storage.models.Name; +import java.util.Arrays; + +/** Samples for BlobServices SetServiceProperties. */ +public final class BlobServicesSetServicePropertiesSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/BlobServicesPut.json + */ + /** + * Sample code: PutBlobServices. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void putBlobServices(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobServices() + .setServicePropertiesWithResponse( + "res4410", + "sto8607", + new BlobServicePropertiesInner() + .withCors( + new CorsRules() + .withCorsRules( + Arrays + .asList( + new CorsRule() + .withAllowedOrigins( + Arrays.asList("http://www.contoso.com", "http://www.fabrikam.com")) + .withAllowedMethods( + Arrays + .asList( + CorsRuleAllowedMethodsItem.GET, + CorsRuleAllowedMethodsItem.HEAD, + CorsRuleAllowedMethodsItem.POST, + CorsRuleAllowedMethodsItem.OPTIONS, + CorsRuleAllowedMethodsItem.MERGE, + CorsRuleAllowedMethodsItem.PUT)) + .withMaxAgeInSeconds(100) + .withExposedHeaders(Arrays.asList("x-ms-meta-*")) + .withAllowedHeaders( + Arrays.asList("x-ms-meta-abc", "x-ms-meta-data*", "x-ms-meta-target*")), + new CorsRule() + .withAllowedOrigins(Arrays.asList("*")) + .withAllowedMethods(Arrays.asList(CorsRuleAllowedMethodsItem.GET)) + .withMaxAgeInSeconds(2) + .withExposedHeaders(Arrays.asList("*")) + .withAllowedHeaders(Arrays.asList("*")), + new CorsRule() + .withAllowedOrigins( + Arrays.asList("http://www.abc23.com", "https://www.fabrikam.com/*")) + .withAllowedMethods( + Arrays + .asList( + CorsRuleAllowedMethodsItem.GET, CorsRuleAllowedMethodsItem.PUT)) + .withMaxAgeInSeconds(2000) + .withExposedHeaders( + Arrays.asList("x-ms-meta-abc", "x-ms-meta-data*", "x -ms-meta-target*")) + .withAllowedHeaders(Arrays.asList("x-ms-meta-12345675754564*"))))) + .withDefaultServiceVersion("2017-07-29") + .withDeleteRetentionPolicy(new DeleteRetentionPolicy().withEnabled(true).withDays(300)) + .withIsVersioningEnabled(true) + .withChangeFeed(new ChangeFeed().withEnabled(true).withRetentionInDays(7)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/BlobServicesPutLastAccessTimeBasedTracking.json + */ + /** + * Sample code: BlobServicesPutLastAccessTimeBasedTracking. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void blobServicesPutLastAccessTimeBasedTracking( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getBlobServices() + .setServicePropertiesWithResponse( + "res4410", + "sto8607", + new BlobServicePropertiesInner() + .withLastAccessTimeTrackingPolicy( + new LastAccessTimeTrackingPolicy() + .withEnable(true) + .withName(Name.ACCESS_TIME_TRACKING) + .withTrackingGranularityInDays(1) + .withBlobType(Arrays.asList("blockBlob"))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/DeletedAccountsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/DeletedAccountsGetSamples.java new file mode 100644 index 0000000000000..d14c7f0a279a2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/DeletedAccountsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for DeletedAccounts Get. */ +public final class DeletedAccountsGetSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/DeletedAccountGet.json + */ + /** + * Sample code: DeletedAccountGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deletedAccountGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getDeletedAccounts() + .getWithResponse("sto1125", "eastus", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/DeletedAccountsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/DeletedAccountsListSamples.java new file mode 100644 index 0000000000000..b0039cc7e86d3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/DeletedAccountsListSamples.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.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for DeletedAccounts List. */ +public final class DeletedAccountsListSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/DeletedAccountList.json + */ + /** + * Sample code: DeletedAccountList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deletedAccountList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.storageAccounts().manager().serviceClient().getDeletedAccounts().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/EncryptionScopesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/EncryptionScopesGetSamples.java new file mode 100644 index 0000000000000..2b9014b3d1734 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/EncryptionScopesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for EncryptionScopes Get. */ +public final class EncryptionScopesGetSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountGetEncryptionScope.json + */ + /** + * Sample code: StorageAccountGetEncryptionScope. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountGetEncryptionScope(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getEncryptionScopes() + .getWithResponse("resource-group-name", "{storage-account-name}", "{encryption-scope-name}", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/EncryptionScopesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/EncryptionScopesListSamples.java new file mode 100644 index 0000000000000..d6a62defef630 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/EncryptionScopesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for EncryptionScopes List. */ +public final class EncryptionScopesListSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountEncryptionScopeList.json + */ + /** + * Sample code: StorageAccountEncryptionScopeList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountEncryptionScopeList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getEncryptionScopes() + .list("resource-group-name", "{storage-account-name}", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/EncryptionScopesPatchSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/EncryptionScopesPatchSamples.java new file mode 100644 index 0000000000000..1bea6009e43ef --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/EncryptionScopesPatchSamples.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.fluent.models.EncryptionScopeInner; +import com.azure.resourcemanager.storage.models.EncryptionScopeKeyVaultProperties; +import com.azure.resourcemanager.storage.models.EncryptionScopeSource; + +/** Samples for EncryptionScopes Patch. */ +public final class EncryptionScopesPatchSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountPatchEncryptionScope.json + */ + /** + * Sample code: StorageAccountPatchEncryptionScope. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountPatchEncryptionScope(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getEncryptionScopes() + .patchWithResponse( + "resource-group-name", + "{storage-account-name}", + "{encryption-scope-name}", + new EncryptionScopeInner() + .withSource(EncryptionScopeSource.MICROSOFT_KEY_VAULT) + .withKeyVaultProperties( + new EncryptionScopeKeyVaultProperties() + .withKeyUri("https://testvault.vault.core.windows.net/keys/key1/863425f1358359c")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/EncryptionScopesPutSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/EncryptionScopesPutSamples.java new file mode 100644 index 0000000000000..671abab1b0aba --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/EncryptionScopesPutSamples.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.fluent.models.EncryptionScopeInner; + +/** Samples for EncryptionScopes Put. */ +public final class EncryptionScopesPutSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountPutEncryptionScopeWithInfrastructureEncryption.json + */ + /** + * Sample code: StorageAccountPutEncryptionScopeWithInfrastructureEncryption. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountPutEncryptionScopeWithInfrastructureEncryption( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getEncryptionScopes() + .putWithResponse( + "resource-group-name", + "{storage-account-name}", + "{encryption-scope-name}", + new EncryptionScopeInner().withRequireInfrastructureEncryption(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountPutEncryptionScope.json + */ + /** + * Sample code: StorageAccountPutEncryptionScope. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountPutEncryptionScope(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getEncryptionScopes() + .putWithResponse( + "resource-group-name", + "{storage-account-name}", + "{encryption-scope-name}", + new EncryptionScopeInner(), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileServicesGetServicePropertiesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileServicesGetServicePropertiesSamples.java new file mode 100644 index 0000000000000..a3342365f684b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileServicesGetServicePropertiesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for FileServices GetServiceProperties. */ +public final class FileServicesGetServicePropertiesSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/FileServicesGet.json + */ + /** + * Sample code: GetFileServices. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getFileServices(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getFileServices() + .getServicePropertiesWithResponse("res4410", "sto8607", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileServicesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileServicesListSamples.java new file mode 100644 index 0000000000000..ff284d1de22aa --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileServicesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for FileServices List. */ +public final class FileServicesListSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/FileServicesList.json + */ + /** + * Sample code: ListFileServices. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listFileServices(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getFileServices() + .listWithResponse("res9290", "sto1590", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileServicesSetServicePropertiesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileServicesSetServicePropertiesSamples.java new file mode 100644 index 0000000000000..467934321a436 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileServicesSetServicePropertiesSamples.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.fluent.models.FileServicePropertiesInner; +import com.azure.resourcemanager.storage.models.CorsRule; +import com.azure.resourcemanager.storage.models.CorsRuleAllowedMethodsItem; +import com.azure.resourcemanager.storage.models.CorsRules; +import com.azure.resourcemanager.storage.models.Multichannel; +import com.azure.resourcemanager.storage.models.ProtocolSettings; +import com.azure.resourcemanager.storage.models.SmbSetting; +import java.util.Arrays; + +/** Samples for FileServices SetServiceProperties. */ +public final class FileServicesSetServicePropertiesSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/FileServicesPut.json + */ + /** + * Sample code: PutFileServices. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void putFileServices(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getFileServices() + .setServicePropertiesWithResponse( + "res4410", + "sto8607", + new FileServicePropertiesInner() + .withCors( + new CorsRules() + .withCorsRules( + Arrays + .asList( + new CorsRule() + .withAllowedOrigins( + Arrays.asList("http://www.contoso.com", "http://www.fabrikam.com")) + .withAllowedMethods( + Arrays + .asList( + CorsRuleAllowedMethodsItem.GET, + CorsRuleAllowedMethodsItem.HEAD, + CorsRuleAllowedMethodsItem.POST, + CorsRuleAllowedMethodsItem.OPTIONS, + CorsRuleAllowedMethodsItem.MERGE, + CorsRuleAllowedMethodsItem.PUT)) + .withMaxAgeInSeconds(100) + .withExposedHeaders(Arrays.asList("x-ms-meta-*")) + .withAllowedHeaders( + Arrays.asList("x-ms-meta-abc", "x-ms-meta-data*", "x-ms-meta-target*")), + new CorsRule() + .withAllowedOrigins(Arrays.asList("*")) + .withAllowedMethods(Arrays.asList(CorsRuleAllowedMethodsItem.GET)) + .withMaxAgeInSeconds(2) + .withExposedHeaders(Arrays.asList("*")) + .withAllowedHeaders(Arrays.asList("*")), + new CorsRule() + .withAllowedOrigins( + Arrays.asList("http://www.abc23.com", "https://www.fabrikam.com/*")) + .withAllowedMethods( + Arrays + .asList( + CorsRuleAllowedMethodsItem.GET, CorsRuleAllowedMethodsItem.PUT)) + .withMaxAgeInSeconds(2000) + .withExposedHeaders( + Arrays.asList("x-ms-meta-abc", "x-ms-meta-data*", "x-ms-meta-target*")) + .withAllowedHeaders(Arrays.asList("x-ms-meta-12345675754564*"))))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/FileServicesPut_EnableSecureSmbFeatures.json + */ + /** + * Sample code: PutFileServices_EnableSecureSmbFeatures. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void putFileServicesEnableSecureSmbFeatures(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getFileServices() + .setServicePropertiesWithResponse( + "res4410", + "sto8607", + new FileServicePropertiesInner() + .withProtocolSettings( + new ProtocolSettings() + .withSmb( + new SmbSetting() + .withVersions("SMB2.1;SMB3.0;SMB3.1.1") + .withAuthenticationMethods("NTLMv2;Kerberos") + .withKerberosTicketEncryption("RC4-HMAC;AES-256") + .withChannelEncryption("AES-128-CCM;AES-128-GCM;AES-256-GCM"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/FileServicesPut_EnableSMBMultichannel.json + */ + /** + * Sample code: PutFileServices_EnableSMBMultichannel. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void putFileServicesEnableSMBMultichannel(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getFileServices() + .setServicePropertiesWithResponse( + "res4410", + "sto8607", + new FileServicePropertiesInner() + .withProtocolSettings( + new ProtocolSettings() + .withSmb(new SmbSetting().withMultichannel(new Multichannel().withEnabled(true)))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileSharesCreateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileSharesCreateSamples.java new file mode 100644 index 0000000000000..79776584fe97a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileSharesCreateSamples.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.fluent.models.FileShareInner; +import com.azure.resourcemanager.storage.models.EnabledProtocols; +import com.azure.resourcemanager.storage.models.ShareAccessTier; + +/** Samples for FileShares Create. */ +public final class FileSharesCreateSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/FileSharesPut_AccessTier.json + */ + /** + * Sample code: PutShares with Access Tier. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void putSharesWithAccessTier(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getFileShares() + .createWithResponse( + "res346", + "sto666", + "share1235", + new FileShareInner().withAccessTier(ShareAccessTier.HOT), + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/FileSharesPut_NFS.json + */ + /** + * Sample code: Create NFS Shares. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void createNFSShares(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getFileShares() + .createWithResponse( + "res346", + "sto666", + "share1235", + new FileShareInner().withEnabledProtocols(EnabledProtocols.NFS), + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/FileSharesPut.json + */ + /** + * Sample code: PutShares. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void putShares(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getFileShares() + .createWithResponse("res3376", "sto328", "share6185", new FileShareInner(), null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileSharesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileSharesDeleteSamples.java new file mode 100644 index 0000000000000..c8407af1de388 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileSharesDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for FileShares Delete. */ +public final class FileSharesDeleteSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/FileSharesDelete.json + */ + /** + * Sample code: DeleteShares. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void deleteShares(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getFileShares() + .deleteWithResponse("res4079", "sto4506", "share9689", null, null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileSharesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileSharesGetSamples.java new file mode 100644 index 0000000000000..43583d8f2efbf --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileSharesGetSamples.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.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for FileShares Get. */ +public final class FileSharesGetSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/FileSharesGet_Stats.json + */ + /** + * Sample code: GetShareStats. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getShareStats(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getFileShares() + .getWithResponse("res9871", "sto6217", "share1634", "stats", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/FileSharesGet.json + */ + /** + * Sample code: GetShares. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void getShares(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getFileShares() + .getWithResponse("res9871", "sto6217", "share1634", null, null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileSharesLeaseSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileSharesLeaseSamples.java new file mode 100644 index 0000000000000..e154df33dbf88 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileSharesLeaseSamples.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.models.LeaseShareAction; +import com.azure.resourcemanager.storage.models.LeaseShareRequest; + +/** Samples for FileShares Lease. */ +public final class FileSharesLeaseSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/FileSharesLease_Break.json + */ + /** + * Sample code: Break a lease on a share. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void breakALeaseOnAShare(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getFileShares() + .leaseWithResponse( + "res3376", + "sto328", + "share12", + null, + new LeaseShareRequest() + .withAction(LeaseShareAction.BREAK) + .withLeaseId("8698f513-fa75-44a1-b8eb-30ba336af27d"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/FileSharesLease_Acquire.json + */ + /** + * Sample code: Acquire a lease on a share. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void acquireALeaseOnAShare(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getFileShares() + .leaseWithResponse( + "res3376", + "sto328", + "share124", + null, + new LeaseShareRequest().withAction(LeaseShareAction.ACQUIRE).withLeaseDuration(-1), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileSharesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileSharesListSamples.java new file mode 100644 index 0000000000000..3c0f5b0e44034 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileSharesListSamples.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for FileShares List. */ +public final class FileSharesListSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/FileSharesList.json + */ + /** + * Sample code: ListShares. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listShares(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getFileShares() + .list("res9290", "sto1590", null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/DeletedFileSharesList.json + */ + /** + * Sample code: ListDeletedShares. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listDeletedShares(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getFileShares() + .list("res9290", "sto1590", null, null, "deleted", Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/FileShareSnapshotsList.json + */ + /** + * Sample code: ListShareSnapshots. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void listShareSnapshots(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getFileShares() + .list("res9290", "sto1590", null, null, "snapshots", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileSharesRestoreSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileSharesRestoreSamples.java new file mode 100644 index 0000000000000..066a3951565a4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileSharesRestoreSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.models.DeletedShare; + +/** Samples for FileShares Restore. */ +public final class FileSharesRestoreSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/FileSharesRestore.json + */ + /** + * Sample code: RestoreShares. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void restoreShares(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getFileShares() + .restoreWithResponse( + "res3376", + "sto328", + "share1249", + new DeletedShare().withDeletedShareName("share1249").withDeletedShareVersion("1234567890"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileSharesUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileSharesUpdateSamples.java new file mode 100644 index 0000000000000..aa968e61febe1 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/FileSharesUpdateSamples.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.fluent.models.FileShareInner; +import com.azure.resourcemanager.storage.models.AccessPolicy; +import com.azure.resourcemanager.storage.models.SignedIdentifier; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for FileShares Update. */ +public final class FileSharesUpdateSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/FileSharesPatch.json + */ + /** + * Sample code: UpdateShares. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateShares(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getFileShares() + .updateWithResponse( + "res3376", + "sto328", + "share6185", + new FileShareInner().withMetadata(mapOf("type", "image")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/FileShareAclsPatch.json + */ + /** + * Sample code: UpdateShareAcls. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void updateShareAcls(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getFileShares() + .updateWithResponse( + "res3376", + "sto328", + "share6185", + new FileShareInner() + .withSignedIdentifiers( + Arrays + .asList( + new SignedIdentifier() + .withId("MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI") + .withAccessPolicy( + new AccessPolicy() + .withStartTime(OffsetDateTime.parse("2021-04-01T08:49:37.0000000Z")) + .withExpiryTime(OffsetDateTime.parse("2021-05-01T08:49:37.0000000Z")) + .withPermission("rwd")))), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/ManagementPoliciesCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/ManagementPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..98ccd9e3d0b21 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/ManagementPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,313 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.fluent.models.ManagementPolicyInner; +import com.azure.resourcemanager.storage.models.DateAfterCreation; +import com.azure.resourcemanager.storage.models.DateAfterModification; +import com.azure.resourcemanager.storage.models.ManagementPolicyAction; +import com.azure.resourcemanager.storage.models.ManagementPolicyBaseBlob; +import com.azure.resourcemanager.storage.models.ManagementPolicyDefinition; +import com.azure.resourcemanager.storage.models.ManagementPolicyFilter; +import com.azure.resourcemanager.storage.models.ManagementPolicyName; +import com.azure.resourcemanager.storage.models.ManagementPolicyRule; +import com.azure.resourcemanager.storage.models.ManagementPolicySchema; +import com.azure.resourcemanager.storage.models.ManagementPolicySnapShot; +import com.azure.resourcemanager.storage.models.ManagementPolicyVersion; +import com.azure.resourcemanager.storage.models.RuleType; +import com.azure.resourcemanager.storage.models.TagFilter; +import java.util.Arrays; + +/** Samples for ManagementPolicies CreateOrUpdate. */ +public final class ManagementPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountSetManagementPolicyWithSnapshotAndVersion.json + */ + /** + * Sample code: StorageAccountSetManagementPolicyWithSnapshotAndVersion. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountSetManagementPolicyWithSnapshotAndVersion( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getManagementPolicies() + .createOrUpdateWithResponse( + "res7687", + "sto9699", + ManagementPolicyName.DEFAULT, + new ManagementPolicyInner() + .withPolicy( + new ManagementPolicySchema() + .withRules( + Arrays + .asList( + new ManagementPolicyRule() + .withEnabled(true) + .withName("olcmtest1") + .withType(RuleType.LIFECYCLE) + .withDefinition( + new ManagementPolicyDefinition() + .withActions( + new ManagementPolicyAction() + .withBaseBlob( + new ManagementPolicyBaseBlob() + .withTierToCool( + new DateAfterModification() + .withDaysAfterModificationGreaterThan( + 30.0f)) + .withTierToArchive( + new DateAfterModification() + .withDaysAfterModificationGreaterThan( + 90.0f)) + .withDelete( + new DateAfterModification() + .withDaysAfterModificationGreaterThan( + 1000.0f))) + .withSnapshot( + new ManagementPolicySnapShot() + .withTierToCool( + new DateAfterCreation() + .withDaysAfterCreationGreaterThan(30f)) + .withTierToArchive( + new DateAfterCreation() + .withDaysAfterCreationGreaterThan(90f)) + .withDelete( + new DateAfterCreation() + .withDaysAfterCreationGreaterThan(1000f))) + .withVersion( + new ManagementPolicyVersion() + .withTierToCool( + new DateAfterCreation() + .withDaysAfterCreationGreaterThan(30f)) + .withTierToArchive( + new DateAfterCreation() + .withDaysAfterCreationGreaterThan(90f)) + .withDelete( + new DateAfterCreation() + .withDaysAfterCreationGreaterThan(1000f)))) + .withFilters( + new ManagementPolicyFilter() + .withPrefixMatch(Arrays.asList("olcmtestcontainer1")) + .withBlobTypes(Arrays.asList("blockBlob"))))))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountSetManagementPolicyForBlockAndAppendBlobs.json + */ + /** + * Sample code: StorageAccountSetManagementPolicyForBlockAndAppendBlobs. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountSetManagementPolicyForBlockAndAppendBlobs( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getManagementPolicies() + .createOrUpdateWithResponse( + "res7687", + "sto9699", + ManagementPolicyName.DEFAULT, + new ManagementPolicyInner() + .withPolicy( + new ManagementPolicySchema() + .withRules( + Arrays + .asList( + new ManagementPolicyRule() + .withEnabled(true) + .withName("olcmtest1") + .withType(RuleType.LIFECYCLE) + .withDefinition( + new ManagementPolicyDefinition() + .withActions( + new ManagementPolicyAction() + .withBaseBlob( + new ManagementPolicyBaseBlob() + .withDelete( + new DateAfterModification() + .withDaysAfterModificationGreaterThan( + 90.0f))) + .withSnapshot( + new ManagementPolicySnapShot() + .withDelete( + new DateAfterCreation() + .withDaysAfterCreationGreaterThan(90f))) + .withVersion( + new ManagementPolicyVersion() + .withDelete( + new DateAfterCreation() + .withDaysAfterCreationGreaterThan(90f)))) + .withFilters( + new ManagementPolicyFilter() + .withPrefixMatch(Arrays.asList("olcmtestcontainer1")) + .withBlobTypes( + Arrays.asList("blockBlob", "appendBlob"))))))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountSetManagementPolicy_LastAccessTimeBasedBlobActions.json + */ + /** + * Sample code: StorageAccountSetManagementPolicy_LastAccessTimeBasedBlobActions. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountSetManagementPolicyLastAccessTimeBasedBlobActions( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getManagementPolicies() + .createOrUpdateWithResponse( + "res7687", + "sto9699", + ManagementPolicyName.DEFAULT, + new ManagementPolicyInner() + .withPolicy( + new ManagementPolicySchema() + .withRules( + Arrays + .asList( + new ManagementPolicyRule() + .withEnabled(true) + .withName("olcmtest") + .withType(RuleType.LIFECYCLE) + .withDefinition( + new ManagementPolicyDefinition() + .withActions( + new ManagementPolicyAction() + .withBaseBlob( + new ManagementPolicyBaseBlob() + .withTierToCool( + new DateAfterModification() + .withDaysAfterLastAccessTimeGreaterThan( + 30.0f)) + .withTierToArchive( + new DateAfterModification() + .withDaysAfterLastAccessTimeGreaterThan( + 90.0f)) + .withDelete( + new DateAfterModification() + .withDaysAfterLastAccessTimeGreaterThan( + 1000.0f)) + .withEnableAutoTierToHotFromCool(true)) + .withSnapshot( + new ManagementPolicySnapShot() + .withDelete( + new DateAfterCreation() + .withDaysAfterCreationGreaterThan(30f)))) + .withFilters( + new ManagementPolicyFilter() + .withPrefixMatch(Arrays.asList("olcmtestcontainer")) + .withBlobTypes(Arrays.asList("blockBlob"))))))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountSetManagementPolicy.json + */ + /** + * Sample code: StorageAccountSetManagementPolicies. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountSetManagementPolicies(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getManagementPolicies() + .createOrUpdateWithResponse( + "res7687", + "sto9699", + ManagementPolicyName.DEFAULT, + new ManagementPolicyInner() + .withPolicy( + new ManagementPolicySchema() + .withRules( + Arrays + .asList( + new ManagementPolicyRule() + .withEnabled(true) + .withName("olcmtest1") + .withType(RuleType.LIFECYCLE) + .withDefinition( + new ManagementPolicyDefinition() + .withActions( + new ManagementPolicyAction() + .withBaseBlob( + new ManagementPolicyBaseBlob() + .withTierToCool( + new DateAfterModification() + .withDaysAfterModificationGreaterThan( + 30.0f)) + .withTierToArchive( + new DateAfterModification() + .withDaysAfterModificationGreaterThan( + 90.0f)) + .withDelete( + new DateAfterModification() + .withDaysAfterModificationGreaterThan( + 1000.0f))) + .withSnapshot( + new ManagementPolicySnapShot() + .withDelete( + new DateAfterCreation() + .withDaysAfterCreationGreaterThan(30f)))) + .withFilters( + new ManagementPolicyFilter() + .withPrefixMatch(Arrays.asList("olcmtestcontainer1")) + .withBlobTypes(Arrays.asList("blockBlob")))), + new ManagementPolicyRule() + .withEnabled(true) + .withName("olcmtest2") + .withType(RuleType.LIFECYCLE) + .withDefinition( + new ManagementPolicyDefinition() + .withActions( + new ManagementPolicyAction() + .withBaseBlob( + new ManagementPolicyBaseBlob() + .withTierToCool( + new DateAfterModification() + .withDaysAfterModificationGreaterThan( + 30.0f)) + .withTierToArchive( + new DateAfterModification() + .withDaysAfterModificationGreaterThan( + 90.0f)) + .withDelete( + new DateAfterModification() + .withDaysAfterModificationGreaterThan( + 1000.0f)))) + .withFilters( + new ManagementPolicyFilter() + .withPrefixMatch(Arrays.asList("olcmtestcontainer2")) + .withBlobTypes(Arrays.asList("blockBlob")) + .withBlobIndexMatch( + Arrays + .asList( + new TagFilter() + .withName("tag1") + .withOp("==") + .withValue("val1"), + new TagFilter() + .withName("tag2") + .withOp("==") + .withValue("val2")))))))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/ManagementPoliciesDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/ManagementPoliciesDeleteSamples.java new file mode 100644 index 0000000000000..89d2f55d9109e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/ManagementPoliciesDeleteSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.models.ManagementPolicyName; + +/** Samples for ManagementPolicies Delete. */ +public final class ManagementPoliciesDeleteSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountDeleteManagementPolicy.json + */ + /** + * Sample code: StorageAccountDeleteManagementPolicies. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountDeleteManagementPolicies(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getManagementPolicies() + .deleteWithResponse("res6977", "sto2527", ManagementPolicyName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/ManagementPoliciesGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/ManagementPoliciesGetSamples.java new file mode 100644 index 0000000000000..422638847edb3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/ManagementPoliciesGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.models.ManagementPolicyName; + +/** Samples for ManagementPolicies Get. */ +public final class ManagementPoliciesGetSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountGetManagementPolicy.json + */ + /** + * Sample code: StorageAccountGetManagementPolicies. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountGetManagementPolicies(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getManagementPolicies() + .getWithResponse("res6977", "sto2527", ManagementPolicyName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/ObjectReplicationPoliciesOperationCreateOrUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/ObjectReplicationPoliciesOperationCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..783d93782c519 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/ObjectReplicationPoliciesOperationCreateOrUpdateSamples.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.fluent.models.ObjectReplicationPolicyInner; +import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyFilter; +import com.azure.resourcemanager.storage.models.ObjectReplicationPolicyRule; +import java.util.Arrays; + +/** Samples for ObjectReplicationPoliciesOperation CreateOrUpdate. */ +public final class ObjectReplicationPoliciesOperationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountCreateObjectReplicationPolicyOnSource.json + */ + /** + * Sample code: StorageAccountCreateObjectReplicationPolicyOnSource. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountCreateObjectReplicationPolicyOnSource( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getObjectReplicationPoliciesOperations() + .createOrUpdateWithResponse( + "res7687", + "src1122", + "2a20bb73-5717-4635-985a-5d4cf777438f", + new ObjectReplicationPolicyInner() + .withSourceAccount("src1122") + .withDestinationAccount("dst112") + .withRules( + Arrays + .asList( + new ObjectReplicationPolicyRule() + .withRuleId("d5d18a48-8801-4554-aeaa-74faf65f5ef9") + .withSourceContainer("scont139") + .withDestinationContainer("dcont139") + .withFilters( + new ObjectReplicationPolicyFilter() + .withPrefixMatch(Arrays.asList("blobA", "blobB")) + .withMinCreationTime("2020-02-19T16:05:00Z")))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountUpdateObjectReplicationPolicyOnDestination.json + */ + /** + * Sample code: StorageAccountUpdateObjectReplicationPolicyOnDestination. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountUpdateObjectReplicationPolicyOnDestination( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getObjectReplicationPoliciesOperations() + .createOrUpdateWithResponse( + "res7687", + "dst112", + "2a20bb73-5717-4635-985a-5d4cf777438f", + new ObjectReplicationPolicyInner() + .withSourceAccount("src1122") + .withDestinationAccount("dst112") + .withRules( + Arrays + .asList( + new ObjectReplicationPolicyRule() + .withRuleId("d5d18a48-8801-4554-aeaa-74faf65f5ef9") + .withSourceContainer("scont139") + .withDestinationContainer("dcont139") + .withFilters( + new ObjectReplicationPolicyFilter() + .withPrefixMatch(Arrays.asList("blobA", "blobB"))), + new ObjectReplicationPolicyRule() + .withSourceContainer("scont179") + .withDestinationContainer("dcont179"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountCreateObjectReplicationPolicyOnDestination.json + */ + /** + * Sample code: StorageAccountCreateObjectReplicationPolicyOnDestination. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountCreateObjectReplicationPolicyOnDestination( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getObjectReplicationPoliciesOperations() + .createOrUpdateWithResponse( + "res7687", + "dst112", + "default", + new ObjectReplicationPolicyInner() + .withSourceAccount("src1122") + .withDestinationAccount("dst112") + .withRules( + Arrays + .asList( + new ObjectReplicationPolicyRule() + .withSourceContainer("scont139") + .withDestinationContainer("dcont139") + .withFilters( + new ObjectReplicationPolicyFilter() + .withPrefixMatch(Arrays.asList("blobA", "blobB"))))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountUpdateObjectReplicationPolicyOnSource.json + */ + /** + * Sample code: StorageAccountUpdateObjectReplicationPolicyOnSource. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountUpdateObjectReplicationPolicyOnSource( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getObjectReplicationPoliciesOperations() + .createOrUpdateWithResponse( + "res7687", + "src1122", + "2a20bb73-5717-4635-985a-5d4cf777438f", + new ObjectReplicationPolicyInner() + .withSourceAccount("src1122") + .withDestinationAccount("dst112") + .withRules( + Arrays + .asList( + new ObjectReplicationPolicyRule() + .withRuleId("d5d18a48-8801-4554-aeaa-74faf65f5ef9") + .withSourceContainer("scont139") + .withDestinationContainer("dcont139") + .withFilters( + new ObjectReplicationPolicyFilter() + .withPrefixMatch(Arrays.asList("blobA", "blobB"))), + new ObjectReplicationPolicyRule() + .withRuleId("cfbb4bc2-8b60-429f-b05a-d1e0942b33b2") + .withSourceContainer("scont179") + .withDestinationContainer("dcont179"))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/ObjectReplicationPoliciesOperationDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/ObjectReplicationPoliciesOperationDeleteSamples.java new file mode 100644 index 0000000000000..fa49f7b866fa8 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/ObjectReplicationPoliciesOperationDeleteSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for ObjectReplicationPoliciesOperation Delete. */ +public final class ObjectReplicationPoliciesOperationDeleteSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountDeleteObjectReplicationPolicy.json + */ + /** + * Sample code: StorageAccountDeleteObjectReplicationPolicies. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountDeleteObjectReplicationPolicies( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getObjectReplicationPoliciesOperations() + .deleteWithResponse("res6977", "sto2527", "{objectReplicationPolicy-Id}", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/ObjectReplicationPoliciesOperationGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/ObjectReplicationPoliciesOperationGetSamples.java new file mode 100644 index 0000000000000..1d8b73ec5cae0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/ObjectReplicationPoliciesOperationGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for ObjectReplicationPoliciesOperation Get. */ +public final class ObjectReplicationPoliciesOperationGetSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountGetObjectReplicationPolicy.json + */ + /** + * Sample code: StorageAccountGetObjectReplicationPolicies. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountGetObjectReplicationPolicies( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getObjectReplicationPoliciesOperations() + .getWithResponse("res6977", "sto2527", "{objectReplicationPolicy-Id}", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/ObjectReplicationPoliciesOperationListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/ObjectReplicationPoliciesOperationListSamples.java new file mode 100644 index 0000000000000..7900f7d0a3e9d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/ObjectReplicationPoliciesOperationListSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for ObjectReplicationPoliciesOperation List. */ +public final class ObjectReplicationPoliciesOperationListSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountListObjectReplicationPolicies.json + */ + /** + * Sample code: StorageAccountListObjectReplicationPolicies. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountListObjectReplicationPolicies( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getObjectReplicationPoliciesOperations() + .list("res6977", "sto2527", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/OperationsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..a73ed52a1dd24 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/OperationsList.json + */ + /** + * Sample code: OperationsList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void operationsList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.storageAccounts().manager().serviceClient().getOperations().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/PrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..a3113e4dd2928 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/PrivateEndpointConnectionsDeleteSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountDeletePrivateEndpointConnection.json + */ + /** + * Sample code: StorageAccountDeletePrivateEndpointConnection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountDeletePrivateEndpointConnection( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getPrivateEndpointConnections() + .deleteWithResponse("res6977", "sto2527", "{privateEndpointConnectionName}", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/PrivateEndpointConnectionsGetSamples.java new file mode 100644 index 0000000000000..f727d1239e091 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/PrivateEndpointConnectionsGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountGetPrivateEndpointConnection.json + */ + /** + * Sample code: StorageAccountGetPrivateEndpointConnection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountGetPrivateEndpointConnection( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse("res6977", "sto2527", "{privateEndpointConnectionName}", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/PrivateEndpointConnectionsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/PrivateEndpointConnectionsListSamples.java new file mode 100644 index 0000000000000..3e9b1eced295d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/PrivateEndpointConnectionsListSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections List. */ +public final class PrivateEndpointConnectionsListSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountListPrivateEndpointConnections.json + */ + /** + * Sample code: StorageAccountListPrivateEndpointConnections. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountListPrivateEndpointConnections( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getPrivateEndpointConnections() + .list("res6977", "sto2527", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/PrivateEndpointConnectionsPutSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/PrivateEndpointConnectionsPutSamples.java new file mode 100644 index 0000000000000..c88c84003ae89 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/PrivateEndpointConnectionsPutSamples.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.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.storage.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.storage.models.PrivateLinkServiceConnectionState; + +/** Samples for PrivateEndpointConnections Put. */ +public final class PrivateEndpointConnectionsPutSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountPutPrivateEndpointConnection.json + */ + /** + * Sample code: StorageAccountPutPrivateEndpointConnection. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountPutPrivateEndpointConnection( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getPrivateEndpointConnections() + .putWithResponse( + "res7687", + "sto9699", + "{privateEndpointConnectionName}", + new PrivateEndpointConnectionInner() + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) + .withDescription("Auto-Approved")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/PrivateLinkResourcesListByStorageAccountSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/PrivateLinkResourcesListByStorageAccountSamples.java new file mode 100644 index 0000000000000..874325fc48d65 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/PrivateLinkResourcesListByStorageAccountSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources ListByStorageAccount. */ +public final class PrivateLinkResourcesListByStorageAccountSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountListPrivateLinkResources.json + */ + /** + * Sample code: StorageAccountListPrivateLinkResources. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountListPrivateLinkResources(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getPrivateLinkResources() + .listByStorageAccountWithResponse("res6977", "sto2527", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueCreateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueCreateSamples.java new file mode 100644 index 0000000000000..2d5fb3fed3a50 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueCreateSamples.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.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.fluent.models.StorageQueueInner; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Queue Create. */ +public final class QueueCreateSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/QueueOperationPut.json + */ + /** + * Sample code: QueueOperationPut. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void queueOperationPut(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getQueues() + .createWithResponse("res3376", "sto328", "queue6185", new StorageQueueInner(), Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/QueueOperationPutWithMetadata.json + */ + /** + * Sample code: QueueOperationPutWithMetadata. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void queueOperationPutWithMetadata(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getQueues() + .createWithResponse( + "res3376", + "sto328", + "queue6185", + new StorageQueueInner().withMetadata(mapOf("sample1", "meta1", "sample2", "meta2")), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueDeleteSamples.java new file mode 100644 index 0000000000000..7085896d259c3 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for Queue Delete. */ +public final class QueueDeleteSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/QueueOperationDelete.json + */ + /** + * Sample code: QueueOperationDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void queueOperationDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getQueues() + .deleteWithResponse("res3376", "sto328", "queue6185", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueGetSamples.java new file mode 100644 index 0000000000000..1766bf9f0d4c2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for Queue Get. */ +public final class QueueGetSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/QueueOperationGet.json + */ + /** + * Sample code: QueueOperationGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void queueOperationGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getQueues() + .getWithResponse("res3376", "sto328", "queue6185", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueListSamples.java new file mode 100644 index 0000000000000..9ed3b9da676b2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for Queue List. */ +public final class QueueListSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/QueueOperationList.json + */ + /** + * Sample code: QueueOperationList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void queueOperationList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getQueues() + .list("res9290", "sto328", null, null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueServicesGetServicePropertiesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueServicesGetServicePropertiesSamples.java new file mode 100644 index 0000000000000..2f8053fdb263d --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueServicesGetServicePropertiesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for QueueServices GetServiceProperties. */ +public final class QueueServicesGetServicePropertiesSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/QueueServicesGet.json + */ + /** + * Sample code: QueueServicesGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void queueServicesGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getQueueServices() + .getServicePropertiesWithResponse("res4410", "sto8607", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueServicesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueServicesListSamples.java new file mode 100644 index 0000000000000..682c17e75bebc --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueServicesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for QueueServices List. */ +public final class QueueServicesListSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/QueueServicesList.json + */ + /** + * Sample code: QueueServicesList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void queueServicesList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getQueueServices() + .listWithResponse("res9290", "sto1590", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueServicesSetServicePropertiesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueServicesSetServicePropertiesSamples.java new file mode 100644 index 0000000000000..f8e06d94df655 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueServicesSetServicePropertiesSamples.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.fluent.models.QueueServicePropertiesInner; +import com.azure.resourcemanager.storage.models.CorsRule; +import com.azure.resourcemanager.storage.models.CorsRuleAllowedMethodsItem; +import com.azure.resourcemanager.storage.models.CorsRules; +import java.util.Arrays; + +/** Samples for QueueServices SetServiceProperties. */ +public final class QueueServicesSetServicePropertiesSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/QueueServicesPut.json + */ + /** + * Sample code: QueueServicesPut. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void queueServicesPut(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getQueueServices() + .setServicePropertiesWithResponse( + "res4410", + "sto8607", + new QueueServicePropertiesInner() + .withCors( + new CorsRules() + .withCorsRules( + Arrays + .asList( + new CorsRule() + .withAllowedOrigins( + Arrays.asList("http://www.contoso.com", "http://www.fabrikam.com")) + .withAllowedMethods( + Arrays + .asList( + CorsRuleAllowedMethodsItem.GET, + CorsRuleAllowedMethodsItem.HEAD, + CorsRuleAllowedMethodsItem.POST, + CorsRuleAllowedMethodsItem.OPTIONS, + CorsRuleAllowedMethodsItem.MERGE, + CorsRuleAllowedMethodsItem.PUT)) + .withMaxAgeInSeconds(100) + .withExposedHeaders(Arrays.asList("x-ms-meta-*")) + .withAllowedHeaders( + Arrays.asList("x-ms-meta-abc", "x-ms-meta-data*", "x-ms-meta-target*")), + new CorsRule() + .withAllowedOrigins(Arrays.asList("*")) + .withAllowedMethods(Arrays.asList(CorsRuleAllowedMethodsItem.GET)) + .withMaxAgeInSeconds(2) + .withExposedHeaders(Arrays.asList("*")) + .withAllowedHeaders(Arrays.asList("*")), + new CorsRule() + .withAllowedOrigins( + Arrays.asList("http://www.abc23.com", "https://www.fabrikam.com/*")) + .withAllowedMethods( + Arrays + .asList( + CorsRuleAllowedMethodsItem.GET, CorsRuleAllowedMethodsItem.PUT)) + .withMaxAgeInSeconds(2000) + .withExposedHeaders( + Arrays.asList("x-ms-meta-abc", "x-ms-meta-data*", "x-ms-meta-target*")) + .withAllowedHeaders(Arrays.asList("x-ms-meta-12345675754564*"))))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueUpdateSamples.java new file mode 100644 index 0000000000000..b8635d0c7e984 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/QueueUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.fluent.models.StorageQueueInner; + +/** Samples for Queue Update. */ +public final class QueueUpdateSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/QueueOperationPatch.json + */ + /** + * Sample code: QueueOperationPatch. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void queueOperationPatch(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getQueues() + .updateWithResponse("res3376", "sto328", "queue6185", new StorageQueueInner(), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/SkusListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/SkusListSamples.java new file mode 100644 index 0000000000000..89968749706bb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/SkusListSamples.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.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for Skus List. */ +public final class SkusListSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/SKUList.json + */ + /** + * Sample code: SkuList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void skuList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.storageAccounts().manager().serviceClient().getSkus().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsCheckNameAvailabilitySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsCheckNameAvailabilitySamples.java new file mode 100644 index 0000000000000..e0b3b7401ff2e --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsCheckNameAvailabilitySamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.models.StorageAccountCheckNameAvailabilityParameters; + +/** Samples for StorageAccounts CheckNameAvailability. */ +public final class StorageAccountsCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountCheckNameAvailability.json + */ + /** + * Sample code: StorageAccountCheckNameAvailability. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountCheckNameAvailability(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getStorageAccounts() + .checkNameAvailabilityWithResponse( + new StorageAccountCheckNameAvailabilityParameters().withName("sto3363"), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsCreateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsCreateSamples.java new file mode 100644 index 0000000000000..5a54d23df2d09 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsCreateSamples.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.models.Bypass; +import com.azure.resourcemanager.storage.models.DefaultAction; +import com.azure.resourcemanager.storage.models.Encryption; +import com.azure.resourcemanager.storage.models.EncryptionIdentity; +import com.azure.resourcemanager.storage.models.EncryptionService; +import com.azure.resourcemanager.storage.models.EncryptionServices; +import com.azure.resourcemanager.storage.models.ExpirationAction; +import com.azure.resourcemanager.storage.models.ExtendedLocation; +import com.azure.resourcemanager.storage.models.ExtendedLocationTypes; +import com.azure.resourcemanager.storage.models.Identity; +import com.azure.resourcemanager.storage.models.IdentityType; +import com.azure.resourcemanager.storage.models.KeyPolicy; +import com.azure.resourcemanager.storage.models.KeySource; +import com.azure.resourcemanager.storage.models.KeyType; +import com.azure.resourcemanager.storage.models.KeyVaultProperties; +import com.azure.resourcemanager.storage.models.Kind; +import com.azure.resourcemanager.storage.models.MinimumTlsVersion; +import com.azure.resourcemanager.storage.models.NetworkRuleSet; +import com.azure.resourcemanager.storage.models.RoutingChoice; +import com.azure.resourcemanager.storage.models.RoutingPreference; +import com.azure.resourcemanager.storage.models.SasPolicy; +import com.azure.resourcemanager.storage.models.Sku; +import com.azure.resourcemanager.storage.models.SkuName; +import com.azure.resourcemanager.storage.models.StorageAccountCreateParameters; +import com.azure.resourcemanager.storage.models.UserAssignedIdentity; +import com.azure.resourcemanager.storage.models.VirtualNetworkRule; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for StorageAccounts Create. */ +public final class StorageAccountsCreateSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/NfsV3AccountCreate.json + */ + /** + * Sample code: NfsV3AccountCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void nfsV3AccountCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getStorageAccounts() + .create( + "res9101", + "sto4445", + new StorageAccountCreateParameters() + .withSku(new Sku().withName(SkuName.PREMIUM_LRS)) + .withKind(Kind.BLOCK_BLOB_STORAGE) + .withLocation("eastus") + .withNetworkRuleSet( + new NetworkRuleSet() + .withBypass(Bypass.AZURE_SERVICES) + .withVirtualNetworkRules( + Arrays + .asList( + new VirtualNetworkRule() + .withVirtualNetworkResourceId( + "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.Network/virtualNetworks/net123/subnets/subnet12"))) + .withIpRules(Arrays.asList()) + .withDefaultAction(DefaultAction.ALLOW)) + .withEnableHttpsTrafficOnly(false) + .withIsHnsEnabled(true) + .withEnableNfsV3(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountCreate.json + */ + /** + * Sample code: StorageAccountCreate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountCreate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getStorageAccounts() + .create( + "res9101", + "sto4445", + new StorageAccountCreateParameters() + .withSku(new Sku().withName(SkuName.STANDARD_GRS)) + .withKind(Kind.STORAGE) + .withLocation("eastus") + .withExtendedLocation( + new ExtendedLocation().withName("losangeles001").withType(ExtendedLocationTypes.EDGE_ZONE)) + .withTags(mapOf("key1", "value1", "key2", "value2")) + .withSasPolicy( + new SasPolicy() + .withSasExpirationPeriod("1.15:59:59") + .withExpirationAction(ExpirationAction.LOG)) + .withKeyPolicy(new KeyPolicy().withKeyExpirationPeriodInDays(20)) + .withEncryption( + new Encryption() + .withServices( + new EncryptionServices() + .withBlob(new EncryptionService().withEnabled(true).withKeyType(KeyType.ACCOUNT)) + .withFile(new EncryptionService().withEnabled(true).withKeyType(KeyType.ACCOUNT))) + .withKeySource(KeySource.MICROSOFT_STORAGE) + .withRequireInfrastructureEncryption(false)) + .withIsHnsEnabled(true) + .withRoutingPreference( + new RoutingPreference() + .withRoutingChoice(RoutingChoice.MICROSOFT_ROUTING) + .withPublishMicrosoftEndpoints(true) + .withPublishInternetEndpoints(true)) + .withAllowBlobPublicAccess(false) + .withMinimumTlsVersion(MinimumTlsVersion.TLS1_2) + .withAllowSharedKeyAccess(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountCreateUserAssignedEncryptionIdentityWithCMK.json + */ + /** + * Sample code: StorageAccountCreateUserAssignedEncryptionIdentityWithCMK. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountCreateUserAssignedEncryptionIdentityWithCMK( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getStorageAccounts() + .create( + "res9101", + "sto4445", + new StorageAccountCreateParameters() + .withSku(new Sku().withName(SkuName.STANDARD_LRS)) + .withKind(Kind.STORAGE) + .withLocation("eastus") + .withIdentity( + new Identity() + .withType(IdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}", + new UserAssignedIdentity()))) + .withEncryption( + new Encryption() + .withServices( + new EncryptionServices() + .withBlob(new EncryptionService().withEnabled(true).withKeyType(KeyType.ACCOUNT)) + .withFile(new EncryptionService().withEnabled(true).withKeyType(KeyType.ACCOUNT))) + .withKeySource(KeySource.MICROSOFT_KEYVAULT) + .withKeyVaultProperties( + new KeyVaultProperties() + .withKeyName("wrappingKey") + .withKeyVersion("") + .withKeyVaultUri("https://myvault8569.vault.azure.net")) + .withEncryptionIdentity( + new EncryptionIdentity() + .withEncryptionUserAssignedIdentity( + "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}"))), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsDeleteSamples.java new file mode 100644 index 0000000000000..bfdfd0a920b64 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for StorageAccounts Delete. */ +public final class StorageAccountsDeleteSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountDelete.json + */ + /** + * Sample code: StorageAccountDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getStorageAccounts() + .deleteWithResponse("res4228", "sto2434", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsFailoverSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsFailoverSamples.java new file mode 100644 index 0000000000000..bcb4fb7daf458 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsFailoverSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for StorageAccounts Failover. */ +public final class StorageAccountsFailoverSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountFailover.json + */ + /** + * Sample code: StorageAccountFailover. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountFailover(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getStorageAccounts() + .failover("res4228", "sto2434", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsGetByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..25be0cb658cf0 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsGetByResourceGroupSamples.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.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for StorageAccounts GetByResourceGroup. */ +public final class StorageAccountsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountGetProperties.json + */ + /** + * Sample code: StorageAccountGetProperties. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountGetProperties(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getStorageAccounts() + .getByResourceGroupWithResponse("res9407", "sto8596", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountGetPropertiesCMKEnabled.json + */ + /** + * Sample code: StorageAccountGetPropertiesCMKEnabled. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountGetPropertiesCMKEnabled(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getStorageAccounts() + .getByResourceGroupWithResponse("res9407", "sto8596", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsListAccountSasSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsListAccountSasSamples.java new file mode 100644 index 0000000000000..e3402a407b567 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsListAccountSasSamples.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.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.models.AccountSasParameters; +import com.azure.resourcemanager.storage.models.HttpProtocol; +import com.azure.resourcemanager.storage.models.Permissions; +import com.azure.resourcemanager.storage.models.Services; +import com.azure.resourcemanager.storage.models.SignedResourceTypes; +import java.time.OffsetDateTime; + +/** Samples for StorageAccounts ListAccountSas. */ +public final class StorageAccountsListAccountSasSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountListAccountSAS.json + */ + /** + * Sample code: StorageAccountListAccountSAS. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountListAccountSAS(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getStorageAccounts() + .listAccountSasWithResponse( + "res7985", + "sto8588", + new AccountSasParameters() + .withServices(Services.B) + .withResourceTypes(SignedResourceTypes.S) + .withPermissions(Permissions.R) + .withProtocols(HttpProtocol.HTTPS_HTTP) + .withSharedAccessStartTime(OffsetDateTime.parse("2017-05-24T10:42:03.1567373Z")) + .withSharedAccessExpiryTime(OffsetDateTime.parse("2017-05-24T11:42:03.1567373Z")) + .withKeyToSign("key1"), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsListByResourceGroupSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..ae65e32e43b8f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsListByResourceGroupSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for StorageAccounts ListByResourceGroup. */ +public final class StorageAccountsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountListByResourceGroup.json + */ + /** + * Sample code: StorageAccountListByResourceGroup. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountListByResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getStorageAccounts() + .listByResourceGroup("res6117", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsListKeysSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsListKeysSamples.java new file mode 100644 index 0000000000000..93b49916b396f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsListKeysSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for StorageAccounts ListKeys. */ +public final class StorageAccountsListKeysSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountListKeys.json + */ + /** + * Sample code: StorageAccountListKeys. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountListKeys(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getStorageAccounts() + .listKeysWithResponse("res418", "sto2220", null, Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsListSamples.java new file mode 100644 index 0000000000000..1fe41f471d0a2 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsListSamples.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.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for StorageAccounts List. */ +public final class StorageAccountsListSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountList.json + */ + /** + * Sample code: StorageAccountList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.storageAccounts().manager().serviceClient().getStorageAccounts().list(Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsListServiceSasSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsListServiceSasSamples.java new file mode 100644 index 0000000000000..405f14f5d75f6 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsListServiceSasSamples.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.models.Permissions; +import com.azure.resourcemanager.storage.models.ServiceSasParameters; +import com.azure.resourcemanager.storage.models.SignedResource; +import java.time.OffsetDateTime; + +/** Samples for StorageAccounts ListServiceSas. */ +public final class StorageAccountsListServiceSasSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountListServiceSAS.json + */ + /** + * Sample code: StorageAccountListServiceSAS. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountListServiceSAS(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getStorageAccounts() + .listServiceSasWithResponse( + "res7439", + "sto1299", + new ServiceSasParameters() + .withCanonicalizedResource("/blob/sto1299/music") + .withResource(SignedResource.C) + .withPermissions(Permissions.L) + .withSharedAccessExpiryTime(OffsetDateTime.parse("2017-05-24T11:32:48.8457197Z")), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsRegenerateKeySamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsRegenerateKeySamples.java new file mode 100644 index 0000000000000..e507b83127c79 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsRegenerateKeySamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.models.StorageAccountRegenerateKeyParameters; + +/** Samples for StorageAccounts RegenerateKey. */ +public final class StorageAccountsRegenerateKeySamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountRegenerateKey.json + */ + /** + * Sample code: StorageAccountRegenerateKey. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountRegenerateKey(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getStorageAccounts() + .regenerateKeyWithResponse( + "res4167", "sto3539", new StorageAccountRegenerateKeyParameters().withKeyName("key2"), Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountRegenerateKerbKey.json + */ + /** + * Sample code: StorageAccountRegenerateKerbKey. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountRegenerateKerbKey(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getStorageAccounts() + .regenerateKeyWithResponse( + "res4167", "sto3539", new StorageAccountRegenerateKeyParameters().withKeyName("kerb1"), Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsRestoreBlobRangesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsRestoreBlobRangesSamples.java new file mode 100644 index 0000000000000..73edd3a978c5f --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsRestoreBlobRangesSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.models.BlobRestoreParameters; +import com.azure.resourcemanager.storage.models.BlobRestoreRange; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for StorageAccounts RestoreBlobRanges. */ +public final class StorageAccountsRestoreBlobRangesSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/BlobRangesRestore.json + */ + /** + * Sample code: BlobRangesRestore. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void blobRangesRestore(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getStorageAccounts() + .restoreBlobRanges( + "res9101", + "sto4445", + new BlobRestoreParameters() + .withTimeToRestore(OffsetDateTime.parse("2019-04-20T15:30:00.0000000Z")) + .withBlobRanges( + Arrays + .asList( + new BlobRestoreRange() + .withStartRange("container/blobpath1") + .withEndRange("container/blobpath2"), + new BlobRestoreRange().withStartRange("container2/blobpath3").withEndRange(""))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsRevokeUserDelegationKeysSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsRevokeUserDelegationKeysSamples.java new file mode 100644 index 0000000000000..a06f6b9e4cd8a --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsRevokeUserDelegationKeysSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for StorageAccounts RevokeUserDelegationKeys. */ +public final class StorageAccountsRevokeUserDelegationKeysSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountRevokeUserDelegationKeys.json + */ + /** + * Sample code: StorageAccountRevokeUserDelegationKeys. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountRevokeUserDelegationKeys(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getStorageAccounts() + .revokeUserDelegationKeysWithResponse("res4167", "sto3539", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsUpdateSamples.java new file mode 100644 index 0000000000000..fd222abf6a049 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/StorageAccountsUpdateSamples.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.models.ActiveDirectoryProperties; +import com.azure.resourcemanager.storage.models.AzureFilesIdentityBasedAuthentication; +import com.azure.resourcemanager.storage.models.DefaultAction; +import com.azure.resourcemanager.storage.models.DirectoryServiceOptions; +import com.azure.resourcemanager.storage.models.Encryption; +import com.azure.resourcemanager.storage.models.EncryptionIdentity; +import com.azure.resourcemanager.storage.models.EncryptionService; +import com.azure.resourcemanager.storage.models.EncryptionServices; +import com.azure.resourcemanager.storage.models.ExpirationAction; +import com.azure.resourcemanager.storage.models.Identity; +import com.azure.resourcemanager.storage.models.IdentityType; +import com.azure.resourcemanager.storage.models.KeyPolicy; +import com.azure.resourcemanager.storage.models.KeySource; +import com.azure.resourcemanager.storage.models.KeyType; +import com.azure.resourcemanager.storage.models.KeyVaultProperties; +import com.azure.resourcemanager.storage.models.Kind; +import com.azure.resourcemanager.storage.models.MinimumTlsVersion; +import com.azure.resourcemanager.storage.models.NetworkRuleSet; +import com.azure.resourcemanager.storage.models.ResourceAccessRule; +import com.azure.resourcemanager.storage.models.RoutingChoice; +import com.azure.resourcemanager.storage.models.RoutingPreference; +import com.azure.resourcemanager.storage.models.SasPolicy; +import com.azure.resourcemanager.storage.models.Sku; +import com.azure.resourcemanager.storage.models.SkuName; +import com.azure.resourcemanager.storage.models.StorageAccountUpdateParameters; +import com.azure.resourcemanager.storage.models.UserAssignedIdentity; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for StorageAccounts Update. */ +public final class StorageAccountsUpdateSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountEnableAD.json + */ + /** + * Sample code: StorageAccountEnableAD. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountEnableAD(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getStorageAccounts() + .updateWithResponse( + "res9407", + "sto8596", + new StorageAccountUpdateParameters() + .withAzureFilesIdentityBasedAuthentication( + new AzureFilesIdentityBasedAuthentication() + .withDirectoryServiceOptions(DirectoryServiceOptions.AD) + .withActiveDirectoryProperties( + new ActiveDirectoryProperties() + .withDomainName("adtest.com") + .withNetBiosDomainName("adtest.com") + .withForestName("adtest.com") + .withDomainGuid("aebfc118-9fa9-4732-a21f-d98e41a77ae1") + .withDomainSid("S-1-5-21-2400535526-2334094090-2402026252") + .withAzureStorageSid("S-1-5-21-2400535526-2334094090-2402026252-0012"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountEnableCMK.json + */ + /** + * Sample code: StorageAccountEnableCMK. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountEnableCMK(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getStorageAccounts() + .updateWithResponse( + "res9407", + "sto8596", + new StorageAccountUpdateParameters() + .withEncryption( + new Encryption() + .withServices( + new EncryptionServices() + .withBlob(new EncryptionService().withEnabled(true).withKeyType(KeyType.ACCOUNT)) + .withFile(new EncryptionService().withEnabled(true).withKeyType(KeyType.ACCOUNT))) + .withKeySource(KeySource.MICROSOFT_KEYVAULT) + .withKeyVaultProperties( + new KeyVaultProperties() + .withKeyName("wrappingKey") + .withKeyVersion("") + .withKeyVaultUri("https://myvault8569.vault.azure.net"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountUpdate.json + */ + /** + * Sample code: StorageAccountUpdate. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountUpdate(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getStorageAccounts() + .updateWithResponse( + "res9407", + "sto8596", + new StorageAccountUpdateParameters() + .withEncryption( + new Encryption() + .withServices( + new EncryptionServices() + .withBlob(new EncryptionService().withEnabled(true).withKeyType(KeyType.ACCOUNT)) + .withFile(new EncryptionService().withEnabled(true).withKeyType(KeyType.ACCOUNT))) + .withKeySource(KeySource.MICROSOFT_STORAGE)) + .withSasPolicy( + new SasPolicy() + .withSasExpirationPeriod("1.15:59:59") + .withExpirationAction(ExpirationAction.LOG)) + .withKeyPolicy(new KeyPolicy().withKeyExpirationPeriodInDays(20)) + .withNetworkRuleSet( + new NetworkRuleSet() + .withResourceAccessRules( + Arrays + .asList( + new ResourceAccessRule() + .withTenantId("72f988bf-86f1-41af-91ab-2d7cd011db47") + .withResourceId( + "/subscriptions/a7e99807-abbf-4642-bdec-2c809a96a8bc/resourceGroups/res9407/providers/Microsoft.Synapse/workspaces/testworkspace"))) + .withDefaultAction(DefaultAction.ALLOW)) + .withRoutingPreference( + new RoutingPreference() + .withRoutingChoice(RoutingChoice.MICROSOFT_ROUTING) + .withPublishMicrosoftEndpoints(true) + .withPublishInternetEndpoints(true)) + .withAllowBlobPublicAccess(false) + .withMinimumTlsVersion(MinimumTlsVersion.TLS1_2) + .withAllowSharedKeyAccess(true), + Context.NONE); + } + + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountUpdateUserAssignedEncryptionIdentityWithCMK.json + */ + /** + * Sample code: StorageAccountUpdateUserAssignedEncryptionIdentityWithCMK. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void storageAccountUpdateUserAssignedEncryptionIdentityWithCMK( + com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getStorageAccounts() + .updateWithResponse( + "res9101", + "sto4445", + new StorageAccountUpdateParameters() + .withSku(new Sku().withName(SkuName.STANDARD_LRS)) + .withIdentity( + new Identity() + .withType(IdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}", + new UserAssignedIdentity()))) + .withKind(Kind.STORAGE) + .withEncryption( + new Encryption() + .withServices( + new EncryptionServices() + .withBlob(new EncryptionService().withEnabled(true).withKeyType(KeyType.ACCOUNT)) + .withFile(new EncryptionService().withEnabled(true).withKeyType(KeyType.ACCOUNT))) + .withKeySource(KeySource.MICROSOFT_KEYVAULT) + .withKeyVaultProperties( + new KeyVaultProperties() + .withKeyName("wrappingKey") + .withKeyVersion("") + .withKeyVaultUri("https://myvault8569.vault.azure.net")) + .withEncryptionIdentity( + new EncryptionIdentity() + .withEncryptionUserAssignedIdentity( + "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}"))), + 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/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableCreateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableCreateSamples.java new file mode 100644 index 0000000000000..ba1a48ce12f91 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableCreateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for Table Create. */ +public final class TableCreateSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/TableOperationPut.json + */ + /** + * Sample code: TableOperationPut. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tableOperationPut(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getTables() + .createWithResponse("res3376", "sto328", "table6185", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableDeleteSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableDeleteSamples.java new file mode 100644 index 0000000000000..c0a1fb279dddb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for Table Delete. */ +public final class TableDeleteSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/TableOperationDelete.json + */ + /** + * Sample code: TableOperationDelete. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tableOperationDelete(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getTables() + .deleteWithResponse("res3376", "sto328", "table6185", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableGetSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableGetSamples.java new file mode 100644 index 0000000000000..f016f5e53e4cb --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for Table Get. */ +public final class TableGetSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/TableOperationGet.json + */ + /** + * Sample code: TableOperationGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tableOperationGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getTables() + .getWithResponse("res3376", "sto328", "table6185", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableListSamples.java new file mode 100644 index 0000000000000..57e174cca4a37 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableListSamples.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.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for Table List. */ +public final class TableListSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/TableOperationList.json + */ + /** + * Sample code: TableOperationList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tableOperationList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.storageAccounts().manager().serviceClient().getTables().list("res9290", "sto328", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableServicesGetServicePropertiesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableServicesGetServicePropertiesSamples.java new file mode 100644 index 0000000000000..c734ebe3c8c9c --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableServicesGetServicePropertiesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for TableServices GetServiceProperties. */ +public final class TableServicesGetServicePropertiesSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/TableServicesGet.json + */ + /** + * Sample code: TableServicesGet. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tableServicesGet(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getTableServices() + .getServicePropertiesWithResponse("res4410", "sto8607", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableServicesListSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableServicesListSamples.java new file mode 100644 index 0000000000000..403f5a4fa323b --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableServicesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for TableServices List. */ +public final class TableServicesListSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/TableServicesList.json + */ + /** + * Sample code: TableServicesList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tableServicesList(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getTableServices() + .listWithResponse("res9290", "sto1590", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableServicesSetServicePropertiesSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableServicesSetServicePropertiesSamples.java new file mode 100644 index 0000000000000..652ba10211891 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableServicesSetServicePropertiesSamples.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.storage.fluent.models.TableServicePropertiesInner; +import com.azure.resourcemanager.storage.models.CorsRule; +import com.azure.resourcemanager.storage.models.CorsRuleAllowedMethodsItem; +import com.azure.resourcemanager.storage.models.CorsRules; +import java.util.Arrays; + +/** Samples for TableServices SetServiceProperties. */ +public final class TableServicesSetServicePropertiesSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/TableServicesPut.json + */ + /** + * Sample code: TableServicesPut. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tableServicesPut(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getTableServices() + .setServicePropertiesWithResponse( + "res4410", + "sto8607", + new TableServicePropertiesInner() + .withCors( + new CorsRules() + .withCorsRules( + Arrays + .asList( + new CorsRule() + .withAllowedOrigins( + Arrays.asList("http://www.contoso.com", "http://www.fabrikam.com")) + .withAllowedMethods( + Arrays + .asList( + CorsRuleAllowedMethodsItem.GET, + CorsRuleAllowedMethodsItem.HEAD, + CorsRuleAllowedMethodsItem.POST, + CorsRuleAllowedMethodsItem.OPTIONS, + CorsRuleAllowedMethodsItem.MERGE, + CorsRuleAllowedMethodsItem.PUT)) + .withMaxAgeInSeconds(100) + .withExposedHeaders(Arrays.asList("x-ms-meta-*")) + .withAllowedHeaders( + Arrays.asList("x-ms-meta-abc", "x-ms-meta-data*", "x-ms-meta-target*")), + new CorsRule() + .withAllowedOrigins(Arrays.asList("*")) + .withAllowedMethods(Arrays.asList(CorsRuleAllowedMethodsItem.GET)) + .withMaxAgeInSeconds(2) + .withExposedHeaders(Arrays.asList("*")) + .withAllowedHeaders(Arrays.asList("*")), + new CorsRule() + .withAllowedOrigins( + Arrays.asList("http://www.abc23.com", "https://www.fabrikam.com/*")) + .withAllowedMethods( + Arrays + .asList( + CorsRuleAllowedMethodsItem.GET, CorsRuleAllowedMethodsItem.PUT)) + .withMaxAgeInSeconds(2000) + .withExposedHeaders( + Arrays.asList("x-ms-meta-abc", "x-ms-meta-data*", "x-ms-meta-target*")) + .withAllowedHeaders(Arrays.asList("x-ms-meta-12345675754564*"))))), + Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableUpdateSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableUpdateSamples.java new file mode 100644 index 0000000000000..15a7f9bc35ba7 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/TableUpdateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for Table Update. */ +public final class TableUpdateSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/TableOperationPatch.json + */ + /** + * Sample code: TableOperationPatch. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void tableOperationPatch(com.azure.resourcemanager.AzureResourceManager azure) { + azure + .storageAccounts() + .manager() + .serviceClient() + .getTables() + .updateWithResponse("res3376", "sto328", "table6185", Context.NONE); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/UsagesListByLocationSamples.java b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/UsagesListByLocationSamples.java new file mode 100644 index 0000000000000..21ae164a8ed19 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/storage/generated/UsagesListByLocationSamples.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.storage.generated; + +import com.azure.core.util.Context; + +/** Samples for Usages ListByLocation. */ +public final class UsagesListByLocationSamples { + /* + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-04-01/examples/StorageAccountListLocationUsage.json + */ + /** + * Sample code: UsageList. + * + * @param azure The entry point for accessing resource management APIs in Azure. + */ + public static void usageList(com.azure.resourcemanager.AzureResourceManager azure) { + azure.storageAccounts().manager().serviceClient().getUsages().listByLocation("eastus2(stage)", Context.NONE); + } +} diff --git a/sdk/resourcemanager/gulpfile.js b/sdk/resourcemanager/gulpfile.js index 73958423d5d80..786cd2d936b56 100644 --- a/sdk/resourcemanager/gulpfile.js +++ b/sdk/resourcemanager/gulpfile.js @@ -13,7 +13,7 @@ var gulpif = require('gulp-if'); var exec = require('child_process').exec; const mappings = require('./api-specs.json'); -const defaultSpecRoot = "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master"; +const defaultSpecRoot = "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main"; async function defaultInfo() { console.log("Usage: gulp codegen " + @@ -97,13 +97,18 @@ function handleInput(projects, cb) { } function codegen(project, cb) { + packagePath = mappings[project].package.replace(/\./g, '/'); + if (!args['preserve']) { const sourcesToDelete = path.join( mappings[project].dir, '/src/main/java/', - mappings[project].package.replace(/\./g, '/')); + packagePath); deleteFolderRecursive(sourcesToDelete); + + generatedSamplesTarget = path.join('azure-resourcemanager/src/samples/java/', packagePath, 'generated'); + deleteFolderRecursive(generatedSamplesTarget); } // path.join won't work if specRoot is a URL @@ -127,6 +132,7 @@ function codegen(project, cb) { ' --java ' + ' --azure-arm ' + ' --pipeline.modelerfour.additional-checks=false --pipeline.modelerfour.lenient-model-deduplication=true ' + + ' --generate-samples ' + generator + ` --java.namespace=${mappings[project].package} ` + ` --java.output-folder=${outDir} ` + @@ -144,7 +150,15 @@ function codegen(project, cb) { } console.log('Command: ' + cmd); - return execa(cmd, [], { shell: true, stdio: "inherit" }); + autorest_result = execa.sync(cmd, [], { shell: true, stdio: "inherit" }); + + // move generated samples to azure-resourcemanager + generatedSamplesSource = path.join(mappings[project].dir, '/src/samples/java/', packagePath, 'generated'); + generatedSamplesTarget = path.join('azure-resourcemanager/src/samples/java/', packagePath); + copyFolderRecursiveSync(generatedSamplesSource, generatedSamplesTarget); + deleteFolderRecursive(generatedSamplesSource); + + return autorest_result; }; function deleteFolderRecursive(path) { @@ -164,6 +178,43 @@ function deleteFolderRecursive(path) { } }; +function copyFileSync(source, target) { + + var targetFile = target; + + // If target is a directory, a new file with the same name will be created + if ( fs.existsSync( target ) ) { + if ( fs.lstatSync( target ).isDirectory() ) { + targetFile = path.join( target, path.basename( source ) ); + } + } + + fs.writeFileSync(targetFile, fs.readFileSync(source)); +} + +function copyFolderRecursiveSync(source, target) { + var files = []; + + // Check if folder needs to be created or integrated + var targetFolder = path.join( target, path.basename( source ) ); + if ( !fs.existsSync( targetFolder ) ) { + fs.mkdirSync( targetFolder, { recursive: true } ); + } + + // Copy + if ( fs.lstatSync( source ).isDirectory() ) { + files = fs.readdirSync( source ); + files.forEach( function ( file ) { + var curSource = path.join( source, file ); + if ( fs.lstatSync( curSource ).isDirectory() ) { + copyFolderRecursiveSync( curSource, targetFolder ); + } else { + copyFileSync( curSource, targetFolder ); + } + } ); + } +} + async function prepareBuild() { return shell.task('mvn package javadoc:aggregate -DskipTests -q'); }